LBAlertController *alertC = [[LBAlertController alloc] initWithAlertTitle:@"提示" message:@"这是一个自定义弹窗"];
typeof(self) __weak weakSelf = self;
LBAlertActionButton *actionCancelBtn = [[LBAlertActionButton alloc] initWithBounds:CGRectMake(0, 0, CGRectGetWidth(alertC.view.frame)/2, 50) action:^(LBAlertActionButton *sender) {
[weakSelf dismissViewControllerAnimated:YES completion:nil];
}];
[actionCancelBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
actionCancelBtn.backgroundColor = [UIColor orangeColor];
actionCancelBtn.titleLabel.font = [UIFont systemFontOfSize:15];
[actionCancelBtn setTitle:@"取消" forState:UIControlStateNormal];
[alertC addActionButton:actionCancelBtn];
LBAlertActionButton *actionBtn = [[LBAlertActionButton alloc] initWithBounds:CGRectMake(0, 0, CGRectGetWidth(actionCancelBtn.bounds), CGRectGetHeight(actionCancelBtn.bounds)) action:^(LBAlertActionButton *sender) {
[weakSelf dismissViewControllerAnimated:YES completion:nil];
}];
[actionBtn setTitleColor:[UIColor magentaColor] forState:UIControlStateNormal];
actionBtn.titleLabel.font = [UIFont systemFontOfSize:15];
[actionBtn setTitle:@"确定" forState:UIControlStateNormal];
[alertC addActionButton:actionBtn];
UILabel *userView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 100)];
userView.textAlignment = NSTextAlignmentCenter;
userView.text = @"这里可以添加userView";
userView.backgroundColor = [UIColor cyanColor];
alertC.userView = userView;
[self presentViewController:alertC animated:YES completion:nil];
-
Notifications
You must be signed in to change notification settings - Fork 0
扩展系统UIAlertController功能,使其在title和message与actionButton之间的位置能自定义一个view,并且actionButton样式完全由使用者掌控。
License
A1129434577/LBAlertController
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
扩展系统UIAlertController功能,使其在title和message与actionButton之间的位置能自定义一个view,并且actionButton样式完全由使用者掌控。
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published