0

我的应用程序上有 15 个按钮,它们显示为图像。当我单击图像时,会调用 getEventContact 函数,该函数会调出模态视图控制器。在下一个视图中,选择了一个联系人 - 模式视图被关闭并运行 setEventContact 函数(以返回选定的联系人(这是它自己的类))。

有没有办法确定触发 getEventContact 函数的前一个发件人,因为它可能是 15 个按钮之一。

-(IBAction)getEventContact:(id)sender {
    [self performSegueWithIdentifier:@"selectContact" sender:self];
}

-(void)setEventContact:(Contact *)selectedContact
{
    //do something
}

干杯。

4

1 回答 1

1
SomeType *someVariable;

-(IBAction)getEventContact:(id)sender 
{
    someVariable = sender;
    [self performSegueWithIdentifier:@"selectContact" sender:self];
}

-(void)setEventContact:(Contact *)selectedContact
{
    //not a real method
    [someVariable someMethod];
}
于 2012-07-03T16:56:32.987 回答