导入头文件
#import "ACAlert.h"
初始化
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(0, 0, 200, 20);
btn.imageView.contentMode = UIViewContentModeScaleAspectFit;
btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[btn setTitle:@"noLongerReminding" forState:UIControlStateNormal];
btn.titleLabel.font = [UIFont systemFontOfSize:13];
[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[btn setImage:[UIImage imageNamed:@"walletNoSelect"] forState:UIControlStateNormal];
[btn setImage:[UIImage imageNamed:@"walletSelected"] forState:UIControlStateSelected];
[btn addTarget:self action:@selector(Nolongerreminding:) forControlEvents:UIControlEventTouchUpInside];
[ACAlert alert].config
.ACHeaderColor([UIColor redColor])
.ACAddTitle(^(UILabel *label) {
label.text = @"Kindly Reminder";
label.textColor = [UIColor cyanColor];
})
.ACAddContent(^(UILabel *label) {
label.text = @"RemindingMessage";
label.font = [UIFont systemFontOfSize:16];
label.textColor = [UIColor blackColor];
})
.ACAddCustomView(^(ACCustomView *custom) {
custom.view = btn;
custom.positionType = ACCustomViewPositionTypeLeft;
})
.ACItemInsets(UIEdgeInsetsMake(10, 0, -10, 0))
.ACAddAction(^(ACAction *action) {
action.title = @"ok";
action.titleColor = [UIColor blackColor];
action.font = [UIFont systemFontOfSize:16];
action.clickBlock = ^{
NSLog(@"---clickBlock----");
};
})
.ACAddAction(^(ACAction *action) {
action.title = @"cancel";
action.titleColor = [UIColor blackColor];
action.font = [UIFont systemFontOfSize:16];
})
.ACShow();
- (void)Nolongerreminding:(UIButton *)senderBtn {
senderBtn.selected = !senderBtn.selected;
NSLog(@"---------Nolongerreminding------");
}
效果:
注意:
在工程里的目录结构中,要以Main-》AppDelegate为入口,不能出现scene,否则就没有弹框出现了,因为工具类里是以AppDelegate写的