From 3e8437ae559487362fae3525beb79c534c213a51 Mon Sep 17 00:00:00 2001 From: 单军华 Date: Thu, 12 Jul 2018 13:44:34 +0800 Subject: [PATCH] bug修复和功能优化 --- screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Views/conversation/MessageCellBubbleView/EaseBubbleView+Text.m | 65 ++++++++++++++++++++++++++++++++ 1 files changed, 65 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Views/conversation/MessageCellBubbleView/EaseBubbleView+Text.m b/screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Views/conversation/MessageCellBubbleView/EaseBubbleView+Text.m new file mode 100755 index 0000000..738d6a6 --- /dev/null +++ b/screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Views/conversation/MessageCellBubbleView/EaseBubbleView+Text.m @@ -0,0 +1,65 @@ +/************************************************************ + * * Hyphenate CONFIDENTIAL + * __________________ + * Copyright (C) 2016 Hyphenate Inc. All rights reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Hyphenate Inc. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Hyphenate Inc. + */ + +#import "EaseBubbleView+Text.h" + +@implementation EaseBubbleView (Text) + +#pragma mark - private + +- (void)_setupTextBubbleMarginConstraints +{ + NSLayoutConstraint *marginTopConstraint = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeTop multiplier:1.0 constant:self.margin.top]; + NSLayoutConstraint *marginBottomConstraint = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-self.margin.bottom]; + NSLayoutConstraint *marginLeftConstraint = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-self.margin.right]; + NSLayoutConstraint *marginRightConstraint = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:self.margin.left]; + + [self.marginConstraints removeAllObjects]; + [self.marginConstraints addObject:marginTopConstraint]; + [self.marginConstraints addObject:marginBottomConstraint]; + [self.marginConstraints addObject:marginLeftConstraint]; + [self.marginConstraints addObject:marginRightConstraint]; + + [self addConstraints:self.marginConstraints]; +} + +- (void)_setupTextBubbleConstraints +{ + [self _setupTextBubbleMarginConstraints]; +} + +#pragma mark - public + +- (void)setupTextBubbleView +{ + self.textLabel = [[UILabel alloc] init]; + self.textLabel.accessibilityIdentifier = @"text_label"; + self.textLabel.translatesAutoresizingMaskIntoConstraints = NO; + self.textLabel.backgroundColor = [UIColor clearColor]; + self.textLabel.numberOfLines = 0; + [self.backgroundImageView addSubview:self.textLabel]; + + [self _setupTextBubbleConstraints]; +} + +- (void)updateTextMargin:(UIEdgeInsets)margin +{ + if (_margin.top == margin.top && _margin.bottom == margin.bottom && _margin.left == margin.left && _margin.right == margin.right) { + return; + } + _margin = margin; + + [self removeConstraints:self.marginConstraints]; + [self _setupTextBubbleMarginConstraints]; +} + +@end -- Gitblit v1.8.0