willPresentActionSheet 将两个不同的操作表放在一个类中。如何知道哪一个将呈现
在我的课堂上,我需要有 2 个不同的(或更多)操作表。所有工作表都转到 willPresentActionSheet。在 willPresentActionSheet 中,我做了一些事情,例如添加日期选择器。但我如何知道哪个操作表称为 willPresentActionSheet?
编辑:我创建了这样的操作表:
UIActionSheet *asheet = [[UIActionSheet alloc]
initWithTitle:@"Pick a value"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Select"
, nil];
[asheet showInView:[self.view superview]];
[asheet setFrame:CGRectMake(0, 117, 320, 383)];
[asheet release];
In my class I need to have 2 different (or more) actionsheets. All of the sheets go to willPresentActionSheet. In willPresentActionSheet I do things like add a datepicker. But how do I know which actionsheet called the willPresentActionSheet?
EDIT: I created the actionsheet like this:
UIActionSheet *asheet = [[UIActionSheet alloc]
initWithTitle:@"Pick a value"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Select"
, nil];
[asheet showInView:[self.view superview]];
[asheet setFrame:CGRectMake(0, 117, 320, 383)];
[asheet release];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以为操作表设置“标签”,并在
willPresentActionSheet:
方法中检查该标签。简单的!编辑:
设置标签。
并在
willPresentActionSheet:
方法中。You can set the 'tag' for the action sheets, and check the tag in
willPresentActionSheet:
method. Simple!Edit:
Set the tag.
And in
willPresentActionSheet:
method.它将操作表传递到方法中...因此,如果您有(在标头中声明)actionView1 和 actionView2 那么您可以执行...
It passes the actionsheet into the method... So if you have (declared in the header) actionView1 and actionView2 then you can do...