Say I have a function like this:
-(void)activateDict:(NSNumber*)dictID{
}
Then I add a action for my button:
[aBtn addTarget:self action:@selector(activateDict) forControlEvents:UIControlEventTouchUpInside];
There is a parameter in the activateDict function, which is (NSNumber*)dictID, so when I add the action to button, how can I add the parameter to the function? like: action:@selector(activateDict:theDictID).
通常,您可以将activateDict定义为activateDict: (id) sender
,然后将dictID设置为发送者的ivar。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.