這很奇怪。我正好在iPad模擬器中刷一個UITableViewCell。即使下面的事件觸發並且swipedCell不爲零,刪除按鈕也不會出現。實際上,它似乎 - 但只是有時。我從來沒有得到一個不好的訪問或sigbart。UITableViewCell刷卡,但沒有出現刪除按鈕
下面的代碼:
- (void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer
{
if (userListSwipeRightRecognizer.state == UIGestureRecognizerStateEnded) {
CGPoint swipeLocation = [userListSwipeRightRecognizer locationInView:self.outletView];
NSIndexPath *swipedIndexPath = [self.outletView indexPathForRowAtPoint:swipeLocation];
UITableViewCell* swipedCell = [self.outletView cellForRowAtIndexPath:swipedIndexPath];
[swipedCell setEditing:YES];
}
}
這只是一個模擬器的問題還是我做錯了什麼?
你有什麼理由爲什麼你自己處理滑動手勢,而不是讓UITableView自動執行它? – Costique 2011-02-04 18:59:19
我將在單元格被刷過時在附件單元格中顯示「編輯」按鈕。我在做什麼可能不是最好的方法。這是我的第一個應用程序。 – Ali 2011-02-04 19:01:51