English 中文(简体)
用户互动的定位和停止传播
原标题:Capture and stop propagation of user interaction iOS UITableViewCell

我正在做一些习俗,用我分类的一条可贵的电文。 目前,如果我开始横向调整控制反应,但一旦我走到垂直方向,就开始把表观点移入。 我如何阻止这种互动,不去接受《可转让意见》,把它限制在我自己的《可转让意见》中?

最佳回答

您可以尝试贬低可调的意见,超越以下方法:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {  
    UITouch *touch = [touches anyObject];

    // if user tapped on your custom view, disable scroll        
        self.scrollEnabled = NO;
    // end if

    [super touchesBegan:touches withEvent:event];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    self.scrollEnabled = YES;
    [super touchesEnded:touches withEvent:event];
}

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
    self.scrollEnabled = YES;   
    [super touchesCancelled:touches withEvent:event];
}
问题回答

I don t think you can prevent user interaction on the UITableView, since it would affect all the subviews.
I ll try to send the UITableView interaction to the method you want it to use it.

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
   [MyClass myScrollDidStartMethod]; 
}

或使用——(避免) 观点* 这个员额是为了更多了解这一情况。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签