From 45ac27d7abff41e0f2ea323b659366ce49fe7f0d Mon Sep 17 00:00:00 2001 From: nixzhu Date: Mon, 7 Sep 2015 14:31:36 +0800 Subject: [PATCH] frame layout of ChatLeftTextCell --- .../Cells/ChatLeftText/ChatLeftTextCell.swift | 30 ++++++++++++++++++- .../Cells/ChatLeftText/ChatLeftTextCell.xib | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Yep/Views/Cells/ChatLeftText/ChatLeftTextCell.swift b/Yep/Views/Cells/ChatLeftText/ChatLeftTextCell.swift index b4c45119..f98bf3fb 100644 --- a/Yep/Views/Cells/ChatLeftText/ChatLeftTextCell.swift +++ b/Yep/Views/Cells/ChatLeftText/ChatLeftTextCell.swift @@ -21,9 +21,22 @@ class ChatLeftTextCell: ChatBaseCell { // @IBOutlet weak var textContentTextViewLeadingConstraint: NSLayoutConstraint! //@IBOutlet weak var textContentTextViewWidthConstraint: NSLayoutConstraint! + func makeUI() { + + let fullWidth = UIScreen.mainScreen().bounds.width + + let halfAvatarSize = YepConfig.chatCellAvatarSize() / 2 + + avatarImageView.center = CGPoint(x: YepConfig.chatCellGapBetweenWallAndAvatar() + halfAvatarSize, y: halfAvatarSize) + } + override func awakeFromNib() { super.awakeFromNib() + backgroundColor = UIColor.greenColor() + + makeUI() + // avatarImageViewLeadingConstraint.constant = YepConfig.chatCellGapBetweenWallAndAvatar() textContentTextView.textContainer.lineFragmentPadding = 0 @@ -85,7 +98,22 @@ class ChatLeftTextCell: ChatBaseCell { // textContentTextViewTrailingConstraint.constant = YepConfig.chatTextGapBetweenWallAndContentLabel() - YepConfig.ChatCell.magicWidth // } - contentView.layoutIfNeeded() +// contentView.layoutIfNeeded() + + + textContainerView.frame = CGRect(x: CGRectGetMaxX(avatarImageView.frame) + YepConfig.chatCellGapBetweenTextContentLabelAndAvatar(), y: 3, width: textContentLabelWidth, height: bounds.height - 3 * 2) + + println(textContainerView.frame) + + bubbleBodyImageView.frame = CGRectInset(textContainerView.frame, -12, -3) + + println(bubbleBodyImageView.frame) + + bubbleTailImageView.center = CGPoint(x: CGRectGetMinX(bubbleBodyImageView.frame), y: CGRectGetMidY(avatarImageView.frame)) + + println(bubbleTailImageView.frame) + + if let sender = message.fromFriend { AvatarCache.sharedInstance.roundAvatarOfUser(sender, withRadius: YepConfig.chatCellAvatarSize() * 0.5) { [weak self] roundImage in diff --git a/Yep/Views/Cells/ChatLeftText/ChatLeftTextCell.xib b/Yep/Views/Cells/ChatLeftText/ChatLeftTextCell.xib index 36968d38..d8a2d205 100644 --- a/Yep/Views/Cells/ChatLeftText/ChatLeftTextCell.xib +++ b/Yep/Views/Cells/ChatLeftText/ChatLeftTextCell.xib @@ -34,7 +34,7 @@ - +