UIAlertController之ActionSheet的使用
2016-07-30 11:01
537 查看
UIAlertController之ActionSheet的使用,actionSheet 需要用到 UIPopoverPresentationController,设置 UIAlertController modalPresentationStyle,才能正常使用,否则会崩溃。
UIViewController *self; // code assumes you're in a view controller UIButton *button; // the button you want to show the popup sheet from UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction *destroyAction = [UIAlertAction actionWithTitle:@"Remove All Data" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { // do destructive stuff here }]; UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"Blah" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { // do something here }]; [alertController addAction:destroyAction]; [alertController addAction:otherAction]; [alertController setModalPresentationStyle:UIModalPresentationPopover]; UIPopoverPresentationController *popPresenter = [alertController popoverPresentationController]; popPresenter.sourceView = button; popPresenter.sourceRect = button.bounds; [self presentViewController:alertController animated:YES completion:nil];
相关文章推荐
- Select data from an Excel sheet in MSSQL
- Default style sheet for HTML 4
- 程序员小抄大全
- 实现全局关闭所有键盘,actionSheet和alertView
- BottomSheetBehavior源码部分浅析
- Apache POI 之 初学实战篇 (二) --- 创建Sheet
- UIAlertController中UIAlertControllerStyleActionSheet与PickerView选择器的结合使用
- Excel Sheet Column Title (easy)
- UIAlertController
- SpriteBuilder中应用智能精灵集之后提示找不到文件的解决
- IONIC----01.ionicActionSheet
- C# 获取Excel工作薄中Sheet页(工作表)名集合
- CMFCPropertySheet和CMFCPropertyPage增强用法
- MFC Page 和Sheet 控件使用例子
- [Mac OSX]MAC读取Excel的Sheet
- 微信weui之actionSheet应用
- excel 表间引用实例
- Film Producer Installs Plastics Recycling System
- c# Excel 图片 粘帖出错, sheet paste
- excel表格出问题了