frame layout of ChatLeftTextCell

This commit is contained in:
nixzhu
2015-09-07 14:31:36 +08:00
parent c102e42e44
commit 45ac27d7ab
2 changed files with 30 additions and 2 deletions
@@ -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
@@ -34,7 +34,7 @@
<subviews>
<textView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" text="Text Content" id="o2v-vm-ItZ" customClass="ChatTextView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="92" height="123"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>