設置UserinteractionEnabled不會阻止委託方法tableView:didSelectRowAtIndexPath:被調用,因此您需要跟蹤包含tableViewCell的行的didSelectRowAtIndexPath調用次數,在這種情況下,它只有一次,並運行
[self performSelectorInBackground:@selector(youtubeFeedMore) withObject:nil];
如果該行被竊聽只有一次。
例如:
@property (assign) BOOL enableLoadMoreCell;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Load more json data if loadmore cell tapped
if (indexPath.row == self.videos.count && self.enableLoadMoreCell == YES) {
self.enableLoadMoreCell = NO;
self.loadCell.userInteractionEnabled = NO;
self.loadCell.title.text = @"loading...";
//Activity indicators for loadmore cell
[self.loadCell.loadMoreActivityIndicator startAnimating];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[self performSelectorInBackground:@selector(youtubeFeedMore) withObject:nil];
}
}
-(void)youtubeFeedMoreSelectorEnded {
....
Your Code
self.enableLoadMoreCell = YES;
}
簡單而有效。謝謝。 – Guferos 2013-02-19 23:26:19
嗨,我意識到這是從近三年前...但是,是否有任何蘋果文檔,說'設置UserinteractionEnabled不會阻止委託方法tableView:didSelectRowAtIndexPath:被調用?我想要實現這一點,但我有點試探性說我的代碼可能會在未來破碎!謝謝 :) – 2015-10-06 22:16:55