|
@@ -54,11 +54,9 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
|
|
|
SDWeiXinPhotoContainerView *_picContainerView;
|
|
|
UILabel *_timeLabel;
|
|
|
UIButton *_moreButton;
|
|
|
- UIButton *_operationButton;
|
|
|
UIButton *_operationLikeButton;
|
|
|
UIButton *_operationCommentButton;
|
|
|
SDTimeLineCellCommentView *_commentView;
|
|
|
- SDTimeLineCellOperationMenu *_operationMenu;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -78,9 +76,7 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
|
|
|
|
|
|
- (void)setup
|
|
|
{
|
|
|
-
|
|
|
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveOperationButtonClickedNotification:) name:kSDTimeLineCellOperationButtonClickedNotification object:nil];
|
|
|
-
|
|
|
+
|
|
|
_iconView = [UIImageView new];
|
|
|
_iconView.clipsToBounds = YES;
|
|
|
_iconView.contentMode = UIViewContentModeScaleAspectFill;
|
|
@@ -114,10 +110,6 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
|
|
|
[_moreButton addTarget:self action:@selector(moreButtonClicked) forControlEvents:UIControlEventTouchUpInside];
|
|
|
_moreButton.titleLabel.font = [UIFont systemFontOfSize:14];
|
|
|
|
|
|
- _operationButton = [UIButton new];
|
|
|
- [_operationButton setImage:[UIImage imageNamed:@"icon_moents_chat"] forState:UIControlStateNormal];
|
|
|
- [_operationButton addTarget:self action:@selector(operationButtonClicked) forControlEvents:UIControlEventTouchUpInside];
|
|
|
-
|
|
|
_operationLikeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
[_operationLikeButton setTitle:@"点赞" forState:UIControlStateNormal];
|
|
|
_operationLikeButton.titleLabel.font = [UIFont systemFontOfSize:10];
|
|
@@ -150,21 +142,7 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
|
|
|
_timeLabel.textColor = SLColor(@"#8E8E93");
|
|
|
_timeLabel.font = [UIFont systemFontOfSize:10];
|
|
|
|
|
|
-
|
|
|
-// _operationMenu = [SDTimeLineCellOperationMenu new];
|
|
|
-// __weak typeof(self) weakSelf = self;
|
|
|
-// [_operationMenu setLikeButtonClickedOperation:^{
|
|
|
-// if ([weakSelf.delegate respondsToSelector:@selector(didClickLikeButtonInCell:)]) {
|
|
|
-// [weakSelf.delegate didClickLikeButtonInCell:weakSelf];
|
|
|
-// }
|
|
|
-// }];
|
|
|
-// [_operationMenu setCommentButtonClickedOperation:^{
|
|
|
-// if ([weakSelf.delegate respondsToSelector:@selector(didClickcCommentButtonInCell:)]) {
|
|
|
-// [weakSelf.delegate didClickcCommentButtonInCell:weakSelf];
|
|
|
-// }
|
|
|
-// }];
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
NSArray *views = @[_iconView, _nameLable, _contentLabel, _moreButton, _picContainerView, _timeLabel, _operationLikeButton, _operationCommentButton, _commentView];
|
|
|
|
|
|
[self.contentView sd_addSubviews:views];
|
|
@@ -222,12 +200,6 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
|
|
|
.leftEqualToView(_contentLabel)
|
|
|
.rightSpaceToView(self.contentView, 14)
|
|
|
.topSpaceToView(_timeLabel, 4); // 已经在内部实现高度自适应所以不需要再设置高度
|
|
|
-
|
|
|
-// _operationMenu.sd_layout
|
|
|
-// .rightSpaceToView(_operationButton, 0)
|
|
|
-// .heightIs(36)
|
|
|
-// .centerYEqualToView(_operationButton)
|
|
|
-// .widthIs(0);
|
|
|
}
|
|
|
|
|
|
- (void)configTheme{
|
|
@@ -306,9 +278,6 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
|
|
|
- (void)setFrame:(CGRect)frame
|
|
|
{
|
|
|
[super setFrame:frame];
|
|
|
- if (_operationMenu.isShowing) {
|
|
|
- _operationMenu.show = NO;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
#pragma mark - private actions
|
|
@@ -320,33 +289,10 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-- (void)operationButtonClicked
|
|
|
-{
|
|
|
- [self postOperationButtonClickedNotification];
|
|
|
- _operationMenu.show = !_operationMenu.isShowing;
|
|
|
-}
|
|
|
-
|
|
|
-- (void)receiveOperationButtonClickedNotification:(NSNotification *)notification
|
|
|
-{
|
|
|
- UIButton *btn = [notification object];
|
|
|
- if (btn != _operationButton && _operationMenu.isShowing) {
|
|
|
- _operationMenu.show = NO;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
|
|
{
|
|
|
[super touchesBegan:touches withEvent:event];
|
|
|
- [self postOperationButtonClickedNotification];
|
|
|
- if (_operationMenu.isShowing) {
|
|
|
- _operationMenu.show = NO;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (void)postOperationButtonClickedNotification
|
|
|
-{
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:kSDTimeLineCellOperationButtonClickedNotification object:_operationButton];
|
|
|
+// [self postOperationButtonClickedNotification];
|
|
|
}
|
|
|
|
|
|
@end
|