如何更改 UIActionSheet 视图?
据我观察,UIActionSheet 在 iPhone 中总是从下侧出现, 但在某些应用程序中,正如我在 AlarmClock 中看到的那样,然后两个按钮变得可见,一个从 iPhone 的上方,第二个从 iPhone 的下方, 那到底是什么,我无法理解,据我感觉,它看起来像UIActionSheet, 我希望我的应用程序之一具有这样的外观...... 帮助!
As I observed that UIActionSheet is always appearing from down side in iPhone,
but in some app, as I saw in AlarmClock, then two button became visible, one from upside and second from downside of iPhone,
What is that exactly, I can't understand, as far as I feel, it looks UIActionSheet,
I want such appearance for one of my app....
Help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,就像 Ole 所说,你不能自定义
UIActionSheet
。但由于它只是一个简单的子视图,您可以通过子视图和动画来创建您的个人“操作表”。因此,如果您希望一个按钮出现在顶部,一个按钮出现在按钮上,则创建两个 UIView,将它们调整为适合您的按钮的大小,添加您的操作表样式背景或任何其他背景,添加您的按钮,将您的 IBActions 连接到按钮和 IBOutlet 到视图。然后,当您希望按钮在屏幕上显示时,将它们设置为动画(使用CGRect
、动画时间,最后使用[UIView commitAnimations]
)Yes just like Ole said, you can't customize
UIActionSheet
. But since it is just a simple subview you can create your personal "action sheet" by subviewing and animating. So if you want a button to appear on the top and one on the button, then create two UIViews resize them to the right size for your button, add your action sheet style background or any other background, add your button, connect your IBActions to the buttons and your IBOutlets to the views. Then when you want the buttons to appear animate them onto the screen (using soneCGRect
, animation time and finally[UIView commitAnimations]
)可能只是一两个带有自定义动画的自定义视图。
UIActionSheet
不可自定义,因此如果您想要默认行为以外的其他内容,则必须自己编写。这并不难。Probably just one or two custom views with a custom animation.
UIActionSheet
is not customizable so if you want something else than the default behavior you have to write it yourself. It's not that difficult.