1
我想取消選擇我的tableview單元格。但在5秒後自動選擇。我嘗試NSTimer
這樣取消選擇單元格後,我選擇
[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector ([tableView deselectRowAtIndexPath:indexPath animated:YES]) userInfo:nil repeats:NO];
在這種方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
但說的XCode我失敗了。
請幫忙 謝謝大家。
dispatch_async在此處是不必要的,因爲dispatch_after將在提供的隊列(主隊列)上執行。 – execv
啊,很好。編輯。 – Rick
您應該製作一個指向tableView的弱指針,以便在您離開tableView所在的場景並且需要解除分配的情況下導航時不泄漏內存。 –