Pergunta

I want to make a view transition, like iPad AppStore on iOS 7, click a item(app) and popping a detail view with flip vertical, and tapping outside of detail view will dismiss, this view transition is neither like popover and modal transition. So, how can I make this transition...

Appreciation for your help.

Foi útil?

Solução

Also looking for the transition animation. But I did figure out how to accomplish the tapping outside of window to dismiss/close. It can be found here.

In your viewDidAppear you create a UITapGestureRecognizer and add it to the view's window. Like so:

UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehind:)];
[recognizer setNumberOfTapsRequired:1];
recognizer.cancelsTouchesInView = NO;
[self.view.window addGestureRecognizer:recognizer];

handleTapBehind checks to see is the Gesture's state has ended and get's the location of the tap and dismisses the view/window

- (void)handleTapBehind:(UITapGestureRecognizer *)sender{
    if (sender.state == UIGestureRecognizerStateEnded){
        CGPoint location = [sender locationInView:nil]; //Passing nil gives us coordinates in the window

        //Check to see if it's in or outside. If outside, dismiss the view.
        if (![self.view pointInside:[self.view convertPoint:location fromView:self.view.window] withEvent:nil]){
            // Remove the recognizer first so it's view.window is valid.
            [self.view.window removeGestureRecognizer:sender];
            [self dismissViewControllerAnimated:YES completion:nil];
        }
    }
}

Hope this helps!

Outras dicas

Start here. This is an example:

[UIView transitionWithView:newView
                  duration:1
                   options:UIViewAnimationOptionTransitionFlipFromLeft 
                animations:^{         // put the animation block here
                           }
                completion:NULL];
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top