注意:我这里的仅仅限于OC,不适用与SWIFT
1首先创建UIAlertController,这里的UIAlertControllerStyleActionSheet是从底部弹出来的效果样式
UIAlertController* alertController = [UIAlertControlleralertControllerWithTitle:@"please selctor"message:@""preferredStyle:UIAlertControllerStyleActionSheet];
2设置名字,,,hander就是给它设置点击事件
UIAlertAction* cameraAction = [UIAlertActionactionWithTitle:@"xxx"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction *action) {
}];
UIAlertAction* photoAction = [UIAlertActionactionWithTitle:@"xxxx"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction *action) {
}];
UIAlertAction* cancelAction = [UIAlertActionactionWithTitle:@"xxxx"style:UIAlertActionStyleDefaulthandler:nil];
3把Avtion装入容器里面
[alertControlleraddAction:cameraAction];
[alertControlleraddAction:photoAction];
[alertControlleraddAction:cancelAction];
4模态跳转弹出来
[selfpresentViewController:alertController animated:YEScompletion:nil];
效果图如:(反正效果就是这样的,图是截取的别人的,有点丑,希望不要介意);