Files
peko-ios/YuMi/Modules/YMMessage/View/Session/Cell/PublicEventTableViewCell.m

134 lines
4.2 KiB
Objective-C

//
// PublicEventTableViewCell.m
// YuMi
//
// Created by P on 2025/5/13.
//
#import "PublicEventTableViewCell.h"
#import "MessagePublicEventModel.h"
@interface PublicEventTableViewCell ()
@property (nonatomic, strong) NetImageView *topImageView;
@property (nonatomic, strong) UIImageView *roomIcon;
@property (nonatomic, strong) UILabel *roomIDLabel;
@property (nonatomic, strong) UILabel *eventDescLabel;
@property (nonatomic, strong) UIButton *joinButton;
@end
@implementation PublicEventTableViewCell
- (void)initSubViews {
[super initSubViews];
// return;
[self.backView addSubview:self.topImageView];
[self.backView addSubview:self.roomIcon];
[self.backView addSubview:self.roomIDLabel];
[self.backView addSubview:self.eventDescLabel];
[self.backView addSubview:self.joinButton];
}
- (void)initSubViewConstraints {
[super initSubViewConstraints];
// return;
[self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.edges.mas_equalTo(self);
make.top.leading.mas_equalTo(self);
make.width.mas_equalTo(self);
make.height.mas_equalTo(86);
}];
[self.roomIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.topImageView.mas_bottom).offset(8);
make.leading.mas_equalTo(8);
make.size.mas_equalTo(CGSizeMake(16, 16));
}];
[self.roomIDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.roomIcon);
make.leading.mas_equalTo(self.roomIcon.mas_trailing).offset(8);
}];
[self.joinButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.trailing.mas_equalTo(-8);
make.size.mas_equalTo(CGSizeMake(96, 30));
}];
[self.eventDescLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.roomIcon.mas_bottom).offset(8);
make.leading.trailing.mas_equalTo(self.backView).inset(8);
make.bottom.mas_equalTo(self.joinButton.mas_top).offset(-8);
}];
}
- (void)didTapJoinButton {
}
- (void)render:(MessageBaseModel *)message {
if ([message isKindOfClass:[MessagePublicEventModel class]]) {
MessagePublicEventModel *model = (MessagePublicEventModel *)message;
NSLog(@"%@", model);
}
}
#pragma mark -
- (NetImageView *)topImageView {
if (!_topImageView) {
NetImageConfig * config = [[NetImageConfig alloc] init];
config.placeHolder = [UIImageConstant defaultBannerPlaceholder];
_topImageView = [[NetImageView alloc] initWithConfig:config];
[_topImageView setCornerRadius:8];
}
return _topImageView;
}
- (UIImageView *)roomIcon {
if (!_roomIcon) {
_roomIcon = [[UIImageView alloc] initWithImage:kImage(@"room_icon")];
}
return _roomIcon;
}
- (UILabel *)roomIDLabel {
if (!_roomIDLabel) {
_roomIDLabel = [UILabel labelInitWithText:YMLocalizedString(@"XPMineGuildViewController6")
font:kFontRegular(13)
textColor:UIColorFromRGB(0x313131)];
}
return _roomIDLabel;
}
- (UILabel *)eventDescLabel {
if (!_eventDescLabel) {
_eventDescLabel = [UILabel labelInitWithText:@"Your Event is about to start! Your fans and subscribers have been notified!"
font:kFontMedium(14)
textColor:UIColorFromRGB(0x313131)];
_eventDescLabel.numberOfLines = 0;
}
return _eventDescLabel;
}
- (UIButton *)joinButton {
if (!_joinButton) {
_joinButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_joinButton setTitle:YMLocalizedString(@"XPCandyTreeViewController4") forState:UIControlStateNormal];
[_joinButton.titleLabel setFont:kFontMedium(14)];
[_joinButton addTarget:self
action:@selector(didTapJoinButton)
forControlEvents:UIControlEventTouchUpInside];
[_joinButton setCornerRadius:15];
[_joinButton addGradientBackgroundWithColors:@[
UIColorFromRGB(0xe29030),
UIColorFromRGB(0xfcc074)
] startPoint:CGPointMake(0, 0.5) endPoint:CGPointMake(1, 0.5) cornerRadius:15];
}
return _joinButton;
}
@end