Objective C 按钮按下来自哪个警报
另一个可能简单的 iPhone obj-c 问题给你...
我有几个警报,其中有按钮,在某些情况下向用户呈现,两者都是一个视图的一部分。现在我知道如何判断按下了哪个按钮,但我如何知道按下的按钮与哪个警报相关?
任何想法都会非常方便!干杯!
another probably simple iPhone obj-c question for you...
I have a couple of alerts which have buttons in them that are presented to the user in certain circumstances, both are part of one view. Now I know how to tell which button was pressed, but how do I know which alert the button pressed is related to?
Any ideas would be really handy! Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为每个警报设置一个标签,并比较委托方法 didDismissWithButtonIndex 捕获的警报的标签。
将标签设置为,
alert.tag = 10;
并将委托签入为
if
(alertView.tag == 10)
Set a tag to each of the alerts, and compare the tag of the alert caught at the delegate method didDismissWithButtonIndex.
Set tag as,
alert.tag = 10;
and check in delegate as
if
(alertView.tag == 10)
尝试为您的警报视图实现一个简单的代理。
例如使用:alertView:clickedButtonAtIndex:
您将能够知道按下的按钮与哪个警报视图相关。
Try to implement a simple delgate for your alert views.
For exemple using : alertView:clickedButtonAtIndex:
you will be able to know which alert view the button pressed is related to.
您可以调用下面解释的 UIAlertView 的委托方法...并检查标题或警报消息,如下所示..这里我给了您标题的示例...
You can call UIAlertView's Delegate method explained below...and check for title or alert message like this.. here i had given you the example of title...