我在這裏有一些構造;當touchesBegin
碰到UITableViewCell
時,我擴展了UITableViewCell
,並在UITableViewController
類中以模態方式顯示UIViewController
。當touchesEnded
命中時,我再次刪除此UIViewController
。UITableViewCell的touchesEnded在頂部顯示ViewController時沒有調用
因此,當您觸摸單元格時顯示內容,當您釋放屏幕時,我再次隱藏它。一切都很好,但如果我快速按下並釋放UITableViewCell,它就不起作用;在這種情況下,不調用touchesEnded
。如果我堅持一秒或更長時間,系統工作正常。 'touchesCledlled'也不會被調用。
對此有何看法?由於焦點位於UITableViewCell
,所以新顯示的UIViewController
或現有的UITableViewController
的觸摸方法也不會觸及(直到我釋放並再次按下,但是這違背了目的)。
相關的代碼:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
amDisplayingCapture = YES;
[self.showCaptureDelegate displayCapture:self.capture];
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
if(amDisplayingCapture)
{
[self.showCaptureDelegate endDisplayCapture];
amDisplayingCapture = NO;
}
}
(該UITableView
的didSelectRowAtIndexPath
不叫要麼一旦我出現新UIViewController
,所以不能使用)
這裏有更多的信息在這裏:https://developer.apple.com/library/ios/documentation/uikit/reference/UIResponder_Class/Reference/Reference.html –
謝謝,但我應該提到touchesCancelled不叫。不在我期望的UITableViewCell中,而不在其他ViewControllers中。 這就像touchesBegan被調用,但隨後消失無蹤。 – Yasper
所有觸摸都應該結束或取消。是否有可能覆蓋這些方法的子視圖? –