123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- //
- // ASHomeActiveView.m
- // Asteria
- //
- // Created by iOS on 2023/6/12.
- //
- #import "ASHomeActiveView.h"
- #import "VerScrollTextView.h"
- @interface ASHomeActiveView ()
- @property (nonatomic, strong) UIButton *bt;
- @property (nonatomic, strong) VerScrollTextView *rollingV;
- @property (nonatomic, strong) NSArray <ASHomeBannerModel *>*topLinkModels;
- @property (nonatomic, strong) NSArray <KWSearchHotKeyModel *>*topKeyModels;
- @end
- @implementation ASHomeActiveView
- - (void)setData:(NSArray <ASHomeBannerModel *>*)arr {
- self.topLinkModels = arr;
- NSMutableArray *tempArr = [NSMutableArray array];
- for (ASHomeBannerModel *m in self.topLinkModels) {
- [tempArr addObject:m.title];
- }
- self.rollingV.sxArry = tempArr;
- }
- - (void)setTopData:(NSArray <KWSearchHotKeyModel *>*)arr; {
- self.topKeyModels = arr;
- NSMutableArray *tempArr = [NSMutableArray array];
- for (KWSearchHotKeyModel *m in self.topKeyModels) {
- [tempArr addObject:m.title];
- }
- self.rollingV.sxArry = tempArr;
- }
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:CGRectMake(0, 0, KScreenWidth, 40)];
- if (self) {
- [self loadSubVs];
- }
- return self;
- }
- - (void)loadSubVs {
- self.backgroundColor = _E0FFF5;
-
- [self addSubview:self.rollingV];
- [self addSubview:self.bt];
-
- [self.rollingV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self);
- }];
- [self.bt mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self);
- }];
-
- }
- - (UIButton *)bt {
- if (!_bt) {
- UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
- [b addTarget:self action:@selector(topLinkTapAction) forControlEvents:UIControlEventTouchUpInside];
- _bt = b;
- }
- return _bt;
- }
- - (VerScrollTextView *)rollingV {
- if (!_rollingV) {
- VerScrollTextView *v = [VerScrollTextView new];
- v.backgroundColor = UIColor.clearColor;
- _rollingV = v;
- }
- return _rollingV;
- }
- - (void)topLinkTapAction {
- NSLog(@"-----topLinkTapAction:%ld", self.rollingV.arrNum);
- if (self.topLinkModels.count > 0 && self.rollingV.arrNum < self.topLinkModels.count) {
- if (self.tapBlock) {
- ASHomeBannerModel * m = self.topLinkModels[self.rollingV.arrNum];
- self.tapBlock(m);
- }
- }
- if (self.topKeyModels.count > 0 && self.rollingV.arrNum < self.topKeyModels.count) {
- if (self.tapBlock) {
- KWSearchHotKeyModel * m = self.topKeyModels[self.rollingV.arrNum];
- self.tapTopBlock(m);
- }
- }
- // HomeBanerModel * m = self.vm.topLinkModels[self.topLinkV.arrNum];
- // if (m.type == 1) {
- // [self goto_WKM_GoodsDetailsC:m.tapUrl];
- // return;
- // }
- // if (m.type == 2) {
- // NSString *typeId = m.tapUrl;
- // [self pushToProductList:@"Products" typeid:typeId];
- // return;
- // }
- // if ([m.tapUrl.lowercaseString hasPrefix:@"http"]) {
- // [self toWebVC:m.tapUrl name:@"WESTKISS"];
- // }
- // }
- }
- @end
|