单击 UITableView 中的一行时遇到问题
我使用此方法didSelectRowAtIndexPath来捕获用户单击一行的时间,但无法正常工作。 用户必须按住该行才能执行操作,但不希望如此。
知道会发生什么吗?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
Refunds *current = [refunds_view objectAtIndex:indexPath.row];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
DetailRefundsViewController *myVC = (DetailRefundsViewController *)[storyboard instantiateViewControllerWithIdentifier:@"DetailRefundsViewController"];
[self presentViewController:myVC animated:YES completion:nil];
}
谢谢。
最诚挚的问候。
最佳答案
在我的例子中,您的代码可以立即运行,只需修改类名和 Storyboard 标识符即可。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
LJWDetailViewController *myVC = (LJWDetailViewController *)[storyboard instantiateViewControllerWithIdentifier:@"LJWDetailViewController"];
[self presentViewController:myVC animated:YES completion:nil];
}
我认为,您的某些代码会阻止此 didSelectRowAtIndexPath: 方法。
找出哪些控件阻止了该方法 并像这样将这些控件的 delaysContentTouches 属性设置为 NO。
_imageScroll.delaysContentTouches = NO;
抱歉英语不好:<
关于ios - 在 UITableView 中单击的事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25049342/