0
touchesBegan方法代碼爲什麼會在我的UITableView中觸發?爲什麼這touchesBegan方法代碼得到我的UITableView觸發器?
背景:我有一個UINavigationController內的UITableView。在UITableView中,我有基於UITableViewCell子類的自定義單元格。我目前在我的UITableView中沒有selectRowAtIndexPath方法。
的答案,將是很好的遮蓋掉將包括若干方面:
爲什麼它不會得到它的工作方面顯然工作
,如何得到一個確保正確的觸摸(單擊)檢測不會阻止其他場景工作,如:選擇表格行,上下滾動tableview內容等。
模擬器應該能夠拾取觸摸等,或在這裏,你所需要的物理設備存在的情況下
代碼:
@interface AppointmentListController : UITableViewController <UIActionSheetDelegate>
.
.
.
@implementation AppointmentListController
.
.
.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
timeStampStart = event.timestamp;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
NSTimeInterval timeStampEnd = event.timestamp;
NSTimeInterval touchDuration = timeStampEnd - timeStampStart;
if(touchDuration > 0.2)
[super touchesEnded:touches withEvent:event];
else
DLog(@" - TOUCH EVENT OCCURS");
[super touchesEnded:touches withEvent:event];
}