54 lines
1.0 KiB
Objective-C
54 lines
1.0 KiB
Objective-C
//
|
|
// SCLiveItemView.m
|
|
// SellyCloudSDK_Example
|
|
//
|
|
// Created by Caleb on 21/7/25.
|
|
// Copyright © 2025 Caleb. All rights reserved.
|
|
//
|
|
|
|
#import "SCLiveItemView.h"
|
|
|
|
@interface SCLiveItemView ()
|
|
@property (nonatomic, strong)UIButton *btn;
|
|
@end
|
|
|
|
@implementation SCLiveItemView
|
|
|
|
- (instancetype)init
|
|
{
|
|
self = [super init];
|
|
if (self) {
|
|
[self setupView];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)btnClick {
|
|
if (self.model.clickCallback) {
|
|
self.model.clickCallback();
|
|
}
|
|
}
|
|
|
|
- (void)setupView {
|
|
[self addSubview:self.btn];
|
|
[self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.size.mas_equalTo(CGSizeMake(60, 30));
|
|
make.center.equalTo(self);
|
|
}];
|
|
}
|
|
|
|
- (void)setModel:(SCLiveItemModel *)model {
|
|
_model = model;
|
|
[self.btn setTitle:model.title forState:UIControlStateNormal];
|
|
}
|
|
|
|
- (UIButton *)btn {
|
|
if (!_btn) {
|
|
_btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _btn;
|
|
}
|
|
|
|
@end
|