Touches began in UITableViewController

后端 未结 5 1918
长发绾君心
长发绾君心 2021-01-17 22:38

I am defining this method in my UITableViewController subclass:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:to         


        
5条回答
  •  无人共我
    2021-01-17 23:05

    Swift Version because I just had this very issue:

    import UIKit
    
    class BubbleTouchesTableView: UITableView {
    
        // Designed to bubble up touches from a UITableView
    
        override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
            super.touchesBegan(touches, withEvent: event)
            self.nextResponder()?.touchesBegan(touches, withEvent: event)
        }
    
        override func touchesCancelled(touches: NSSet, withEvent event: UIEvent) {
            super.touchesCancelled(touches, withEvent: event)
            self.nextResponder()?.touchesCancelled(touches, withEvent: event)
        }
    
        override func touchesEnded(touches: NSSet, withEvent event: UIEvent) {
            super.touchesEnded(touches, withEvent: event)
            self.nextResponder()?.touchesEnded(touches, withEvent: event)
        }
    
        override func touchesMoved(touches: NSSet, withEvent event: UIEvent) {
            super.touchesMoved(touches, withEvent: event)
            self.nextResponder()?.touchesMoved(touches, withEvent: event)
        }
    
    }
    

提交回复
热议问题