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.
精彩评论