59 lines
1.7 KiB
Objective-C
59 lines
1.7 KiB
Objective-C
//
|
|
// LuxADSSModeVC.m
|
|
// TallPaper
|
|
//
|
|
// Created by aaa on 2024/7/26.
|
|
//
|
|
|
|
#import "LuxADSSModeVC.h"
|
|
#import "LuxNetManager.h"
|
|
#import "LuxADManager.h"
|
|
|
|
@interface LuxADSSButton : UIButton
|
|
@property (nonatomic,weak) LuxADManagerInterstitialItem *item;
|
|
@end
|
|
|
|
@implementation LuxADSSButton
|
|
|
|
@end
|
|
|
|
@interface LuxADSSModeVC ()
|
|
|
|
@end
|
|
|
|
@implementation LuxADSSModeVC
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
__block CGFloat currY = 80.0;
|
|
CGFloat cellHeight = 50;
|
|
CGFloat cellPadding = 20;
|
|
CGFloat screenW = [UIScreen mainScreen].bounds.size.width;
|
|
CGFloat cellWidth = (screenW - cellPadding*2);
|
|
|
|
[[[LuxADManager shareInstance] allInterstitialAds] enumerateObjectsUsingBlock:^(LuxADManagerInterstitialItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
CGRect rect = CGRectMake(cellPadding, currY, cellWidth, cellHeight);
|
|
LuxADSSButton *button = [LuxADSSButton new];
|
|
button.item = obj;
|
|
button.frame = rect;
|
|
obj.tapPointX = @(button.center.x);
|
|
obj.tapPointY = @(button.center.y);
|
|
[button addTarget:self action:@selector(clickAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
[button setTitle:[NSString stringWithFormat:@"ID: %@",obj.adItem.adUnitIdentifier] forState:UIControlStateNormal];
|
|
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
button.titleLabel.font = [UIFont systemFontOfSize:18];
|
|
button.backgroundColor = [UIColor orangeColor];
|
|
|
|
[self.view addSubview:button];
|
|
currY += cellPadding + cellHeight;
|
|
}];
|
|
}
|
|
|
|
- (void)clickAction:(LuxADSSButton *)sender {
|
|
sender.item.actionBlock(self);
|
|
NSLog(@"rect:%@",NSStringFromCGRect(sender.frame));
|
|
}
|
|
@end
|