문제

i am using 2 pods.

MMDrawerController 0.5.1& WYPopoverController 0.1.7

now i want to make a WYPopover on my MMView

some pics:

this is how the MMController looks like (Playground)

some playground

now i want to touch it anywhere and make it look like:

normal when touched

the error: if i want to open the left view from the 'MMController' sometimes i get this:

the error

but it should look like (left MMControllerView)

enter image description here

i am using the 2 methods:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
// show the popoverController
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    [popController dismissPopoverAnimated:NO];
}

my question: why the touchesMoved isn't called continuous and if there is a better way?

도움이 되었습니까?

해결책

I don't know anything about the "pods" you mention (CocoaPods?) However, the most straightforward way to distinguish between taps and drags is to use a pair of gesture recognizers, a tap gesture recognizer and a pan gesture recognizer, and set up the tap gesture recognizer so the pan gesture must fail before the tap is triggered (There is a "wait until another gesture recognizer fails" mechanism built into gesture recognizers.)

I suggest reading up on UIGestureRecognizer, and the specific classes UITapGestureRecognizer and UIPanGestureRecognizer

다른 팁

You can dismiss popover when your left menu is going to open, i.e. you can do that in delegate method of your slide menu: - menuWillOpen: or something like this.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top