English 中文(简体)
ICT: Cancel UIScroll 采用2个手法时的观点
原标题:iOS: Cancel UIScrollView touches when using 2 fingers

我写了一门UIScroll级书,我正在用该文 s一系列可读书。 见以下图表:

“entergraph

你可以看到,我有几条垂直滚动的UITableView,这些话正在母体电传中横向发展。 这一切都是罚款。 然而,申请中有一些Global gestures。 例如,如果我用2名计票人朝特定方向飞去,我确实向另一部分电言转变,但如果我以滚动观点和(或)儿童表观点为重,他们自然会改变其内容。 这并不看好,造成一些排他性的问题。

我要指出的是,当用户与2名电离者接触任何地方<><>>时,如何在UIScrollView及其儿童UITableView上排除所有电动,而只有2名电离者。 我尝试了压倒一切的十字路口,触动,触动 如果Cancel等......,但我可以这样做。 任何帮助都受到高度赞赏。

我的姿态处理法是:

UISwipeGestureRecognizer *twoFingerSwipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerSwipe:)];
[twoFingerSwipeUp setNumberOfTouchesRequired:2];
[twoFingerSwipeUp setDirection:UISwipeGestureRecognizerDirectionUp];
[twoFingerSwipeUp setDelegate:self];

//  self  is the superview of the UIScrollView, which is a UIView.
[self addGestureRecognizer:twoFingerSwipeUp];

[twoFingerSwipeUp release];

// ... repeat the above code for up, down, left, right gestures ...

- (void)handleTwoFingerSwipe:(UISwipeGestureRecognizer*)swipeGesture {

    switch ([swipeGesture direction]) {

        case UISwipeGestureRecognizerDirectionUp:            
            [self changeToView:viewAbove];
            break;

        case UISwipeGestureRecognizerDirectionDown:
            [self changeToView:viewBelow];            
            break;

        case UISwipeGestureRecognizerDirectionRight:
            [self changeToView:viewToTheRight];
            break;

        case UISwipeGestureRecognizerDirectionLeft:
            [self changeToView:viewToTheLeft];
            break;            
    }
}
问题回答

Try establishing panGestureRecognizer.maximumNumberOfTouches = 1 on all scroll and table perspectives (iOS 5 only).

如果你重新使用双手wi的 recognise子,那么当双手承认其姿态时,就要求roll(包括桌上的观点——他们还重新浏览)。

[[scrollView panGestureRecognizer] requireGestureRecognizerToFail: twoFingerRecogniser];

为每个发展观和表率列出上述代码。

(P.S.:“recogniser” 是英国的英语,而不是拼写器。)

Hope that helps. :-)

Write this code: scrollView.minimumZoomScale=1.0;scrollView.maximumZoomScale=1.0; scrollView.delegate self];

而且 页: 1 ViewDelegate 方法:-

-(UIView*)viewForZoomingInScrollView:(UIScrollView *)aScrollView{ return aScrollView;}

你们应当做的一件事是检查姿态在采取行动之前已经结束:

if (swipeGesture.state == UIGestureRecognizerStateEnded) {
   // Do your think
}

我知道否则会发生奇事。

父母滚动观点中的可解释的用户互动。 你们需要一个“IDWindow”子级和压倒性——假冒:这种方法被称作“BeFORE”任何姿态识别器。 如果你发现两条线,就会发出通知。 如果情况发生,让滚动观点听取它的意见,让用户相互交流。 如果触动结束,则让用户能够重新互动。





相关问题
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, ...