|
|
@@ -31,7 +31,6 @@
|
|
|
@property (nonatomic, strong) UIView *bottomInfoView;
|
|
|
@property (nonatomic, strong) UILabel *titleLabel;
|
|
|
@property (nonatomic, strong) UILabel *descriptionLabel;
|
|
|
-@property (nonatomic, strong) UIButton *detailButton;
|
|
|
|
|
|
#pragma mark - 数据
|
|
|
@property (nonatomic, strong) JXDramaContent *drama;
|
|
|
@@ -115,14 +114,6 @@
|
|
|
}
|
|
|
|
|
|
- (void)setupInteractionButtons {
|
|
|
- // 创建垂直StackView
|
|
|
- self.interactionStackView = [[UIStackView alloc] init];
|
|
|
- self.interactionStackView.axis = UILayoutConstraintAxisVertical;
|
|
|
- self.interactionStackView.spacing = 24;
|
|
|
- self.interactionStackView.alignment = UIStackViewAlignmentCenter;
|
|
|
- self.interactionStackView.backgroundColor = UIColor.redColor;
|
|
|
- [self.contentView addSubview:self.interactionStackView];
|
|
|
-
|
|
|
// 点赞按钮
|
|
|
[self addLikeButton];
|
|
|
|
|
|
@@ -134,140 +125,82 @@
|
|
|
|
|
|
// 合集按钮
|
|
|
[self addCollectionButton];
|
|
|
-
|
|
|
- // 约束
|
|
|
- self.interactionStackView.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
- [NSLayoutConstraint activateConstraints:@[
|
|
|
- [self.interactionStackView.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor constant:-16],
|
|
|
- [self.interactionStackView.bottomAnchor constraintEqualToAnchor:self.contentView.safeAreaLayoutGuide.bottomAnchor constant:-60]
|
|
|
- ]];
|
|
|
}
|
|
|
|
|
|
- (void)addLikeButton {
|
|
|
- UIView *likeContainer = [[UIView alloc] init];
|
|
|
-
|
|
|
- self.likeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
- [self.likeButton setImage:[UIImage systemImageNamed:@"heart"] forState:UIControlStateNormal];
|
|
|
- [self.likeButton setImage:[UIImage systemImageNamed:@"heart.fill"] forState:UIControlStateSelected];
|
|
|
+
|
|
|
+ UIView *likeContainer = [[UIView alloc] initWithFrame:CGRectMake(self.frame.size.width-48, self.frame.size.height-BAR_HEIGHT - 100 - 130, 32, 50)];
|
|
|
+ self.likeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
|
|
|
+ [self.likeButton setImage:[UIImage imageNamed:@"icon 1.1"] forState:UIControlStateNormal];
|
|
|
+ [self.likeButton setImage:[UIImage imageNamed:@"icon 1.5"] forState:UIControlStateSelected];
|
|
|
self.likeButton.tintColor = [UIColor whiteColor];
|
|
|
[self.likeButton addTarget:self action:@selector(handleLikeTap) forControlEvents:UIControlEventTouchUpInside];
|
|
|
[likeContainer addSubview:self.likeButton];
|
|
|
-
|
|
|
- self.likeCountLabel = [[UILabel alloc] init];
|
|
|
+ self.likeCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 32, 32, 18)];
|
|
|
self.likeCountLabel.textColor = [UIColor whiteColor];
|
|
|
self.likeCountLabel.font = [UIFont systemFontOfSize:12];
|
|
|
self.likeCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
self.likeCountLabel.text = @"0";
|
|
|
[likeContainer addSubview:self.likeCountLabel];
|
|
|
-
|
|
|
- // 约束
|
|
|
- self.likeButton.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
- self.likeCountLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
- [NSLayoutConstraint activateConstraints:@[
|
|
|
- [self.likeButton.topAnchor constraintEqualToAnchor:likeContainer.topAnchor],
|
|
|
- [self.likeButton.centerXAnchor constraintEqualToAnchor:likeContainer.centerXAnchor],
|
|
|
- [self.likeButton.widthAnchor constraintEqualToConstant:40],
|
|
|
- [self.likeButton.heightAnchor constraintEqualToConstant:40],
|
|
|
-
|
|
|
- [self.likeCountLabel.topAnchor constraintEqualToAnchor:self.likeButton.bottomAnchor constant:4],
|
|
|
- [self.likeCountLabel.centerXAnchor constraintEqualToAnchor:likeContainer.centerXAnchor],
|
|
|
- [self.likeCountLabel.bottomAnchor constraintEqualToAnchor:likeContainer.bottomAnchor]
|
|
|
- ]];
|
|
|
-
|
|
|
- [self.interactionStackView addArrangedSubview:likeContainer];
|
|
|
+ [self.contentView addSubview:likeContainer];
|
|
|
}
|
|
|
|
|
|
- (void)addFavoriteButton {
|
|
|
- UIView *favoriteContainer = [[UIView alloc] init];
|
|
|
-
|
|
|
- self.favoriteButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
- [self.favoriteButton setImage:[UIImage systemImageNamed:@"star"] forState:UIControlStateNormal];
|
|
|
- [self.favoriteButton setImage:[UIImage systemImageNamed:@"star.fill"] forState:UIControlStateSelected];
|
|
|
+
|
|
|
+ UIView *favoriteContainer = [[UIView alloc] initWithFrame:CGRectMake(self.frame.size.width-48, self.frame.size.height-BAR_HEIGHT - 100 - 65, 32, 50)];
|
|
|
+ self.favoriteButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
|
|
|
+ [self.favoriteButton setImage:[UIImage imageNamed:@"icon 1.2"] forState:UIControlStateNormal];
|
|
|
+ [self.favoriteButton setImage:[UIImage imageNamed:@"icon 1.5"] forState:UIControlStateSelected];
|
|
|
self.favoriteButton.tintColor = [UIColor whiteColor];
|
|
|
[self.favoriteButton addTarget:self action:@selector(handleFavoriteTap) forControlEvents:UIControlEventTouchUpInside];
|
|
|
[favoriteContainer addSubview:self.favoriteButton];
|
|
|
-
|
|
|
- self.favoriteCountLabel = [[UILabel alloc] init];
|
|
|
+ self.favoriteCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 32, 32, 18)];
|
|
|
self.favoriteCountLabel.textColor = [UIColor whiteColor];
|
|
|
self.favoriteCountLabel.font = [UIFont systemFontOfSize:12];
|
|
|
self.favoriteCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
self.favoriteCountLabel.text = @"0";
|
|
|
[favoriteContainer addSubview:self.favoriteCountLabel];
|
|
|
-
|
|
|
- // 约束
|
|
|
- self.favoriteButton.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
- self.favoriteCountLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
- [NSLayoutConstraint activateConstraints:@[
|
|
|
- [self.favoriteButton.topAnchor constraintEqualToAnchor:favoriteContainer.topAnchor],
|
|
|
- [self.favoriteButton.centerXAnchor constraintEqualToAnchor:favoriteContainer.centerXAnchor],
|
|
|
- [self.favoriteButton.widthAnchor constraintEqualToConstant:40],
|
|
|
- [self.favoriteButton.heightAnchor constraintEqualToConstant:40],
|
|
|
-
|
|
|
- [self.favoriteCountLabel.topAnchor constraintEqualToAnchor:self.favoriteButton.bottomAnchor constant:4],
|
|
|
- [self.favoriteCountLabel.centerXAnchor constraintEqualToAnchor:favoriteContainer.centerXAnchor],
|
|
|
- [self.favoriteCountLabel.bottomAnchor constraintEqualToAnchor:favoriteContainer.bottomAnchor]
|
|
|
- ]];
|
|
|
-
|
|
|
- [self.interactionStackView addArrangedSubview:favoriteContainer];
|
|
|
+ [self.contentView addSubview:favoriteContainer];
|
|
|
}
|
|
|
|
|
|
- (void)addCommentButton {
|
|
|
- UIView *commentContainer = [[UIView alloc] init];
|
|
|
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleCommentTap2)];
|
|
|
- [commentContainer addGestureRecognizer:tap];
|
|
|
- commentContainer.backgroundColor = UIColor.yellowColor;
|
|
|
- self.commentButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
- [self.commentButton setImage:[UIImage systemImageNamed:@"bubble.right"] forState:UIControlStateNormal];
|
|
|
+ UIView *commentContainer = [[UIView alloc] initWithFrame:CGRectMake(self.frame.size.width-48, self.frame.size.height-BAR_HEIGHT - 100, 32, 50)];
|
|
|
+ self.commentButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
|
|
|
+ [self.commentButton setImage:[UIImage imageNamed:@"icon 1.3"] forState:UIControlStateNormal];
|
|
|
self.commentButton.tintColor = [UIColor whiteColor];
|
|
|
-// [self.commentButton addTarget:self action:@selector(handleCommentTap) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- self.commentButton.backgroundColor = UIColor.blackColor;
|
|
|
- self.commentButton.userInteractionEnabled = NO;
|
|
|
-// commentContainer.userInteractionEnabled = YES;
|
|
|
+ [self.commentButton addTarget:self action:@selector(handleCommentTap) forControlEvents:UIControlEventTouchUpInside];
|
|
|
[commentContainer addSubview:self.commentButton];
|
|
|
-
|
|
|
- self.commentCountLabel = [[UILabel alloc] init];
|
|
|
+ self.commentCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 32, 32, 18)];
|
|
|
self.commentCountLabel.textColor = [UIColor whiteColor];
|
|
|
self.commentCountLabel.font = [UIFont systemFontOfSize:12];
|
|
|
self.commentCountLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
self.commentCountLabel.text = @"0";
|
|
|
[commentContainer addSubview:self.commentCountLabel];
|
|
|
-
|
|
|
- // 约束
|
|
|
- self.commentButton.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
- self.commentCountLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
- [NSLayoutConstraint activateConstraints:@[
|
|
|
- [self.commentButton.topAnchor constraintEqualToAnchor:commentContainer.topAnchor],
|
|
|
- [self.commentButton.centerXAnchor constraintEqualToAnchor:commentContainer.centerXAnchor],
|
|
|
- [self.commentButton.widthAnchor constraintEqualToConstant:40],
|
|
|
- [self.commentButton.heightAnchor constraintEqualToConstant:40],
|
|
|
-
|
|
|
- [self.commentCountLabel.topAnchor constraintEqualToAnchor:self.commentButton.bottomAnchor constant:4],
|
|
|
- [self.commentCountLabel.centerXAnchor constraintEqualToAnchor:commentContainer.centerXAnchor],
|
|
|
- [self.commentCountLabel.bottomAnchor constraintEqualToAnchor:commentContainer.bottomAnchor]
|
|
|
- ]];
|
|
|
-
|
|
|
- [self.interactionStackView addArrangedSubview:commentContainer];
|
|
|
+ [self.contentView addSubview:commentContainer];
|
|
|
}
|
|
|
|
|
|
- (void)addCollectionButton {
|
|
|
- self.collectionButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
- [self.collectionButton setImage:[UIImage systemImageNamed:@"square.grid.2x2"] forState:UIControlStateNormal];
|
|
|
- self.collectionButton.tintColor = [UIColor whiteColor];
|
|
|
- [self.collectionButton addTarget:self action:@selector(handleCollectionTap) forControlEvents:UIControlEventTouchUpInside];
|
|
|
-
|
|
|
- // 约束
|
|
|
- self.collectionButton.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
- [NSLayoutConstraint activateConstraints:@[
|
|
|
- [self.collectionButton.widthAnchor constraintEqualToConstant:40],
|
|
|
- [self.collectionButton.heightAnchor constraintEqualToConstant:40]
|
|
|
- ]];
|
|
|
+ UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.frame.size.height - 38 - BAR_HEIGHT, SCREEN_WIDTH, 38)];
|
|
|
+ bottomView.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:0.1];
|
|
|
+ [self.contentView addSubview:bottomView];
|
|
|
+ UIImageView *sImgView = [[UIImageView alloc] initWithFrame:CGRectMake(16, 10.5, 17, 17)];
|
|
|
+ sImgView.image = [UIImage imageNamed:@"icon 2.1 拷贝"];
|
|
|
+ [bottomView addSubview:sImgView];
|
|
|
+ UILabel *hjL = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(sImgView.frame)+4, 0, 100, 38)];
|
|
|
+ [bottomView addSubview:hjL];
|
|
|
+ hjL.font = [UIFont boldSystemFontOfSize:18];
|
|
|
+ hjL.textColor = UIColor.whiteColor;
|
|
|
+ hjL.text = @"合集";
|
|
|
+ UIImageView *mImgView = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-27, 13.5, 11, 11)];
|
|
|
+ mImgView.image = [UIImage imageNamed:@"Frame 9366"];
|
|
|
+ [bottomView addSubview:mImgView];
|
|
|
+ UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleCollectionTap)];
|
|
|
+ [bottomView addGestureRecognizer:tap];
|
|
|
|
|
|
- [self.interactionStackView addArrangedSubview:self.collectionButton];
|
|
|
}
|
|
|
|
|
|
- (void)setupBottomInfo {
|
|
|
self.bottomInfoView = [[UIView alloc] init];
|
|
|
- self.bottomInfoView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
|
|
|
[self.contentView addSubview:self.bottomInfoView];
|
|
|
|
|
|
// 标题
|
|
|
@@ -279,29 +212,20 @@
|
|
|
|
|
|
// 描述
|
|
|
self.descriptionLabel = [[UILabel alloc] init];
|
|
|
- self.descriptionLabel.textColor = [UIColor colorWithWhite:1.0 alpha:0.8];
|
|
|
- self.descriptionLabel.font = [UIFont systemFontOfSize:14];
|
|
|
+ self.descriptionLabel.textColor = [UIColor colorWithWhite:1.0 alpha:1];
|
|
|
+ self.descriptionLabel.font = [UIFont systemFontOfSize:15];
|
|
|
self.descriptionLabel.numberOfLines = 2;
|
|
|
[self.bottomInfoView addSubview:self.descriptionLabel];
|
|
|
|
|
|
- // 详情按钮
|
|
|
- self.detailButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
|
|
- [self.detailButton setTitle:@"查看全部" forState:UIControlStateNormal];
|
|
|
- [self.detailButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
- self.detailButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
|
|
- [self.detailButton addTarget:self action:@selector(handleDetailTap) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- [self.bottomInfoView addSubview:self.detailButton];
|
|
|
-
|
|
|
// 约束
|
|
|
self.bottomInfoView.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
self.descriptionLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
- self.detailButton.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
|
|
|
[NSLayoutConstraint activateConstraints:@[
|
|
|
[self.bottomInfoView.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor],
|
|
|
- [self.bottomInfoView.trailingAnchor constraintEqualToAnchor:self.interactionStackView.leadingAnchor constant:-16],
|
|
|
- [self.bottomInfoView.bottomAnchor constraintEqualToAnchor:self.contentView.safeAreaLayoutGuide.bottomAnchor constant:-120],
|
|
|
+ [self.bottomInfoView.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor constant:-90],
|
|
|
+ [self.bottomInfoView.bottomAnchor constraintEqualToAnchor:self.contentView.safeAreaLayoutGuide.bottomAnchor constant:-(BAR_HEIGHT+54)],
|
|
|
[self.bottomInfoView.heightAnchor constraintGreaterThanOrEqualToConstant:80],
|
|
|
|
|
|
[self.titleLabel.topAnchor constraintEqualToAnchor:self.bottomInfoView.topAnchor constant:12],
|
|
|
@@ -312,9 +236,6 @@
|
|
|
[self.descriptionLabel.leadingAnchor constraintEqualToAnchor:self.bottomInfoView.leadingAnchor constant:16],
|
|
|
[self.descriptionLabel.trailingAnchor constraintEqualToAnchor:self.bottomInfoView.trailingAnchor constant:-16],
|
|
|
|
|
|
- [self.detailButton.topAnchor constraintEqualToAnchor:self.descriptionLabel.bottomAnchor constant:8],
|
|
|
- [self.detailButton.leadingAnchor constraintEqualToAnchor:self.bottomInfoView.leadingAnchor constant:16],
|
|
|
- [self.detailButton.bottomAnchor constraintEqualToAnchor:self.bottomInfoView.bottomAnchor constant:-12]
|
|
|
]];
|
|
|
}
|
|
|
|
|
|
@@ -494,37 +415,31 @@
|
|
|
NSLog(@"[JXShortDramaCell] ⚠️ delegate 不响应 shortDramaCellDidTapFavorite");
|
|
|
}
|
|
|
}
|
|
|
-- (void)handleCommentTap2{
|
|
|
-
|
|
|
-}
|
|
|
+
|
|
|
- (void)handleCommentTap {
|
|
|
|
|
|
- if ([self.delegate respondsToSelector:@selector(shortDramaCellDidTapComment:)]) {
|
|
|
- [self.delegate shortDramaCellDidTapComment:self];
|
|
|
- }
|
|
|
+ NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - 评论按钮被点击!");
|
|
|
+ NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate: %@", self.delegate);
|
|
|
+ NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate class: %@", [self.delegate class]);
|
|
|
|
|
|
-// NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - 评论按钮被点击!");
|
|
|
-// NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate: %@", self.delegate);
|
|
|
-// NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate class: %@", [self.delegate class]);
|
|
|
-//
|
|
|
-// if (self.delegate) {
|
|
|
-// NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate 存在");
|
|
|
-//
|
|
|
-// SEL selector = @selector(shortDramaCellDidTapComment:);
|
|
|
-// BOOL responds = [self.delegate respondsToSelector:selector];
|
|
|
-// NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate 响应 shortDramaCellDidTapComment: %@",
|
|
|
-// responds ? @"YES ✅" : @"NO ❌");
|
|
|
-//
|
|
|
-// if (responds) {
|
|
|
-// NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - 调用 delegate 方法");
|
|
|
-// [self.delegate shortDramaCellDidTapComment:self];
|
|
|
-// NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate 方法已调用");
|
|
|
-// } else {
|
|
|
-// NSLog(@"[JXShortDramaCell] ❌ handleCommentTap - delegate 不响应该方法");
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// NSLog(@"[JXShortDramaCell] ❌ handleCommentTap - delegate 为 nil");
|
|
|
-// }
|
|
|
+ if (self.delegate) {
|
|
|
+ NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate 存在");
|
|
|
+
|
|
|
+ SEL selector = @selector(shortDramaCellDidTapComment:);
|
|
|
+ BOOL responds = [self.delegate respondsToSelector:selector];
|
|
|
+ NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate 响应 shortDramaCellDidTapComment: %@",
|
|
|
+ responds ? @"YES ✅" : @"NO ❌");
|
|
|
+
|
|
|
+ if (responds) {
|
|
|
+ NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - 调用 delegate 方法");
|
|
|
+ [self.delegate shortDramaCellDidTapComment:self];
|
|
|
+ NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate 方法已调用");
|
|
|
+ } else {
|
|
|
+ NSLog(@"[JXShortDramaCell] ❌ handleCommentTap - delegate 不响应该方法");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ NSLog(@"[JXShortDramaCell] ❌ handleCommentTap - delegate 为 nil");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- (void)handleCollectionTap {
|