项目介绍:
目录介绍:
JSAlertMultiModel 模型
JSAlertAction JSAlertSheet上的活动
JSSheepPresentTransition 模态动画实现的代理
JSAlertSheetViewController 弹出框所在的控制器
使用:
<JSAlertSheetViewControllerDelegate>遵守协议
//实现代理方法
- (void)js_alertSheetViewController:(JSAlertSheetViewController *)alertController selectedIndex:(NSInteger)index;
//弹出
JSSheepPresentTransition *transition = [[JSSheepPresentTransition alloc]init];
JSAlertSheetViewController *alertSheet = [[JSAlertSheetViewController alloc]initWithTransition:transition];
alertSheet.delegate = self;
NSArray *titles = @[@"系统指定",@"高级专家",@"知名专家",@"指定专家"];
NSArray *images = @[@"image1",@"image2",@"image3",@"image4"];
NSMutableArray <JSAlertMultiModel *> *models = [NSMutableArray arrayWithCapacity:titles.count];
for (NSInteger i = 0; i < titles.count; i++) {
JSAlertMultiModel *model = [JSAlertMultiModel new];
model.title = titles[i];
model.imageName = images[i];
[models addObject:model];
}
JSAlertAction *action = [JSAlertAction multiSelectAlertActionWithMutiModels:[models copy]];
[alertSheet addAction:action];
[self presentViewController:alertSheet animated:YES completion:nil];
//注意
@property (nonatomic, strong)JSSheepPresentTransition *transition;
- (instancetype)initWithTransition:(JSSheepPresentTransition *)transition{
if (self = [super init]) {
self.modalPresentationStyle = UIModalPresentationCustom;
self.transitioningDelegate = transition;
self.transition = transition;
}
return self;
}
①模态风格 UIModalPresentationCustom
②设置代理
③用属性接住transition防止死亡
以上就是这期的更新,希望能够帮助一下小伙伴进步
[JSAlertController] (https://github.com/kaqise/JSAlertController.git)