iphone - 从子 UIViewController 呈现 UIActionSheet

标签 iphone ios cocoa-touch ios5 uiactionsheet

我的容器 View Controller 呈现了一系列 subview ,每个 subview 都有自己的 UIViewController。当按下其中一个 subview 上的按钮时,我需要显示 UIActionSheet

从父 View Controller 的工具栏显示此操作表的正确方法是什么? iOS 5 的新容器 View Controller 支持是否提供了一种简单的方法来做到这一点?或者我应该使用委托(delegate)让容器 Controller 知道按钮被按下了吗?

最佳答案

我对这个问题不是很有经验,但是你不能将 parentViewController 属性作为 UIActionSheet 的委托(delegate)传递吗?在呈现操作表时,传递 parentViewController 的属性,例如它的 View 或工具栏?

不过,从工程的角度来看,我更喜欢你使用委托(delegate)的想法。阅读充当 UIActionSheet 委托(delegate)的 View Controller 的代码似乎很奇怪,但不知道为什么首先要显示它。

关于iphone - 从子 UIViewController 呈现 UIActionSheet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12762373/

相关文章:

iphone - 为什么 Wingdings 在 iOS 5 上无法运行?为什么我无法在 iPhone 应用程序中使用 Wingdings?

ios - ScrollView 对齐问题

ios - UIPageViewController:如何在 View Controller 之间设置 "negative"间距(具有滚动过渡样式)

iphone - NSURLConnection 和处理响应代码和响应数据

ios - 后台任务有限制吗?

iphone - 如何使 'touchesBegan' 方法适用于特定 View ?

iphone - 当 iPod 音乐停止时获取通知

ios - 如何解决 'Object has been deleted or invalidated.' Realm 异常

cocoa-touch - 重写 -handlePan : in UIScrollView

iphone - 单位换算库 - Objective C