开发者

selector for a method with multiple parameters

Hi all I need to write selector for this method. How can I do it? Thanx!

- (UITableViewC开发者_JS百科ell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

Here is the code where I need it:

UIBarButtonItem *deleteButton = [[UIBarButtonItem alloc]  initWithTitle:@"Delete User" style:UIBarButtonItemStyleBordered target:self action:@selector(my_button_click_here_is_need_a_selector:)];

[toolbar setItems:[NSArray arrayWithObjects: deleteButton, nil]];


See How to pass method arguments to a selector on how to create a selector for that method (the answer is @selector(tableView:cellForRowAtIndexPath:)).

But you are using the -initWithTitle:… method wrongly if you pass this selector. The action's selector must be a callback in the one of the forms

-(IBAction)clicked;
-(IBAction)clicked:(id)sender;
-(IBAction)clicked:(id)sender withEvent:(UIEvent*)event;

the -tableView:cellForRowAtIndexPath: is none of the above. You should write a specific method for it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜