有人让 UIActionSheet (buttonIndex, delegate) 更像 UIButton (addTarget:action) 吗?
我看到了 Marco Armant 的这条推文:
对按钮上的
UIActionSheet w/target:action:userInfo:
进行子类化以避免 delegate/buttonIndex。难道没有其他人这样做过吗?找不到。
我认为这听起来是个好主意,但我找不到任何人执行此操作的代码。有谁知道,在我自己去之前做一下吗?
I saw this tweet by Marco Armant:
Subclassed
UIActionSheet w/target:action:userInfo:
on buttons to avoid delegates/buttonIndex. Didn't someone else do this? Can't find it.
I think that sounds like a great idea, but I wasn't able to find anyone's code that did this. Does anyone know of one, before I go do it myself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,请参阅我的 github 中的
OHActionSheet
。它是使用块实现的,因此您可以通过这种方式使用它,即使不移出源代码中其他位置的目标/操作代码,最大的优点是所有内容都位于源代码中的同一位置,并且您可以在同一控制器中使用任意数量的
OHActionSheets
[编辑]编辑示例代码以添加更多详细信息和使用示例
Yes, see my github for
OHActionSheet
.It is implemented using blocks, so that you can use it this way, even without deporting the target/action code elsewere in your source code, the great advantage being that everything is located in the same place in your source code, and that you can use as many
OHActionSheets
as you want in the same controller[EDIT] Edited sample code to add more details and usage examples