iOS:如何将多个参数传递给Selector Objective-c?

时间:2016-09-22 16:28:43

标签: ios objective-c parameters selector performselector

对不起,iOS开发的新功能,我通过网络搜索但没有成功回答。我的问题是如何将多个参数传递给选择器,我的意思是下面的代码与一个参数(发件人)工作正常:

 [menuItems addObject:[KxMenuItem
                                        menuItem:optionContexts[j]
                                        image:nil
                                        target:self
                                        action:@selector(pushMenuItem:)]
                              ];

- (void) pushMenuItem:(id)sender 
{
}

但是我需要传递多个参数(发件人,标签),为此目的,以下代码不起作用:

action:[self performSelector:@selector(pushMenuItem:) withObject:tag]

所以,如果我想拥有以下方法(功能)

- (void) pushMenuItem:(id)sender :(NSInteger) tag
{
}

我的action:selector电话应该如何?

P.S:这是外部(kxmenu库): https://github.com/kolyvan/kxmenu

https://github.com/kolyvan/kxmenu/blob/master/KxMenuExample/ViewController.m

0 个答案:

没有答案