Iphone willPresentActionSheet在一个类中包含两个不同的动作表。如何知道谁会出席

Iphone willPresentActionSheet在一个类中包含两个不同的动作表。如何知道谁会出席,iphone,objective-c,ios,uiactionsheet,Iphone,Objective C,Ios,Uiactionsheet,在我的课堂上,我需要有两个不同(或更多)的行动表。所有工作表都转到willPresentActionSheet。在willPresentActionSheet中,我会添加一个日期选择器。但我怎么知道哪张行动单叫做“遗嘱陈述表” 编辑:我创建了如下操作表: UIActionSheet *asheet = [[UIActionSheet alloc] initWithTitle:@"Pick a value"

在我的课堂上,我需要有两个不同(或更多)的行动表。所有工作表都转到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];

它将操作表传递到方法中。。。因此,如果您有(在标题中声明)actionView1和actionView2,那么您可以

if([actionSheet isEqual:actionView1]) {
  // do stuff for 1
} else if([actionSheet isEqual:actionView2]) {
  // do stuff for 2
}

您可以为操作表设置“标记”,并在
willpresentationsheet:
方法中检查标记。简单

编辑: 设置标签

actionSheet1.tag = 100;
actionSheet2.tag = 101;
而在
willPresentActionSheet:
方法中

if (actionSheet.tag == 100) {  
    // actionSheet1 is going to be presented
} else if (actionSheet.tag == 101) {
    // actionSheet2 is going to be presented
} 

... 然后,您可以通过标签来区分操作表(在创建时设置了标签)。这是因为UIActionSheet是UIView的一个子类。我对iPhone还不熟悉,还没有完全掌握一切。我在问题中添加了上面的代码,显示了我是如何开始操作表的。我需要做些什么才能在标题中声明它呢?我不太喜欢标记方法,但这是一种非常好的方法。标记似乎是在willPresentActionSheet中设置的,但我需要知道它是哪个操作表。我看到标题是设置好的,我可以使用它吗?好的,我发现我可以在创建ActionSheet时设置标签。谢谢你的主意!是的,但那是事实。如何知道为哪个操作表设置了什么标记?我在创建操作表时找到了如何创建标记。非常感谢。