我有一个表格视图,当我点击时我正在使用附件按钮我想要导航到其他视图控制器。我这样做了:
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
DateViewController *objDateViewController = [[DateViewController alloc]initWithNibName:@"DateViewController" bundle:nil];
[self.navigationController pushViewController:objDateViewController animated:YES];
}
但它不起作用。请帮忙。
答案 0 :(得分:2)
试试这个
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
...
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button addTarget:self action:@selector(checkButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
...
cell.accessoryView = button;
return cell;
}
- (void)checkButtonTapped:(id)sender {
}
答案 1 :(得分:0)
检查您的委托方法是否被触发?
viewcontroller
navigationcontroller
(表格视图所在的位置)
醇>