开发者

Howto make iPhone screens sliding out? (Animation)

in some iPhone/iPad Apps you can see screens sliding in and out.

How does the straight slide in/out work?

I could only find Curl and Flip for animation: UIViewAnimationTransitionFlipFromLeft, UIViewAnima开发者_StackOverflowtionTransitionFlipFromRight, UIViewAnimationTransitionCurlUp, UIViewAnimationTransitionCurlDown,


not sure what you mean by sliding in and out, perhaps provide an example app with it

I think you mean pushing a view to the left to reveal the next view under it or something similar

-(void) slideView:(UIView *)uiv_slide toReveal:(UIView *)uiv_reveal withDuration:(double)d_duration {
    //Add the subview to the ViewController's view
    [self.view addSubview:uiv_reveal];

    //Bring the view to slide to the front
    [self.view bringSubviewToFront:uiv_slide];

    //Make an animation to slide the view off the screen
    [UIView animateWithDuration:d_duration
        animations:^ {
            uiv_slide.center = CGPointMake(-1*(uiv_slide.frame.size.width/2), uiv_slide.frame.size.height/2);  
        }
    ];
}

hopefully the code helps


If you make your app based on the navigation app template, the transitions for going from view to view will have that slide in/out animation.


Take a look at some custom animations here. This will allow you to animate your views however you want. You can also use the apple navigation controller to build a drill down structure to your apps. Those view will automatically slide transition.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜