Gar*_*ary 1 uiviewcontroller uiactionsheet presentmodalviewcontroller ios
下面是这样的情况:我有一个类MainView(它是一个UIViewController)并从中调用一个UIActionSheetDelegate类.我想使用presentViewController方法,但以下代码不起作用(当前在ActionSheet类中调用):
[self presentViewController:myViewController animated:YES];
Run Code Online (Sandbox Code Playgroud)
关于从(MainView或ActionSheetDelegate)调用方法的地方我有点困惑.
提前致谢.
你在你的MainView的UIViewController 上调用该方法,并将你希望成为ActionSheet的UIViewController 传递给它.
[mainViewController presentViewController:actionSheetController animated:YES];
Run Code Online (Sandbox Code Playgroud)
要关闭UIActionSheet,dimissWithClickedButtonIndex:animated:可以实现UIActionSheet的方法.任何人都可以调用该方法(因此,如果您想从主视图中删除它,请参考操作表并执行类似的操作[self.myActionSheet dismissWithClickedButtonIndex:0 animated:YES];
只要用户点击"取消"按钮,也会调用该方法.
| 归档时间: |
|
| 查看次数: |
20237 次 |
| 最近记录: |