【发布时间】:2012-08-23 19:37:52
【问题描述】:
当触摸UITableViewCell 时,我有一个应用程序会关闭并转到 Safari 打开 URL。但是,当我返回应用程序时,仍会选择该单元格几秒钟。为什么不立即取消选择?它是一个错误吗?代码如下:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:NO];
if (indexPath.section == 0 && indexPath.row == 0) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.example.com/"]];
}
}
我尝试将[tableView deselectRowAtIndexPath:indexPath animated:NO]; 移到顶部并关闭动画,但没有帮助。这没什么大不了的,但如果可能的话,我希望它立即取消选择。
UIButton 也会发生这种情况。返回应用程序后,它会保持突出显示状态一两秒。
【问题讨论】:
-
你能发布更多代码吗
标签: objective-c ios uitableview