Customizing Uinavigationcontroller push and Pop animations

Source: Internet
Author: User

http://segmentfault.com/q/1010000000143983

The default animations for Uinavigationcontroller push and pop are both left and right, and my application requires that the animation of this interface switch be a bit more complex, presumably with a few:

    • Faster around the launch, the default is 0.3 seconds, I need to be one times faster
    • With jitter around the launch
    • Flip horizontally
    • Paper Flip Effect

But these switches should be put in the Navigationcontroller to do management, how to achieve, to find a train of thought

    • Ios
    • Link
    • Comments
    • More
Sort By default sorting time 3 answersthe answer is helpful to the person, has the reference value0 The answer is no help, it's the wrong answer, irrelevantly replying .Adopted YUANLIZBYY 275November 28, 2012 answer

1. If the landlord wants to use the view controller stack in Uinavigationcontroller, and also want to customize the push, pop animation effect, it is basically impossible. The reason is that if you want to use the view controller stack, you can't dodge
Pushviewcontroller:animated: This method, and once used pushviewcontroller:animated:, Uinavigationcontroller will force the frame of the viewcontroller to be pushed into the frame of the current viewable area, thus breaking all the posterior steps that you want to customize the animation for, such as the following code, which will not have any effect:

Uinavigationcontroller+customanimation.h

Uinavigationcontroller (customanimation)-(void) Custompushviewcontroller: (Uiviewcontroller *) Viewcontroller; @end   

Uinavigationcontroller+customanimation.m

#import"Uinavigationcontroller+customanimation.h"-(void) Custompushviewcontroller: (Uiviewcontroller *) viewcontroller{Viewcontroller. View. frame = (CGRect) {0,-viewcontroller.view.frame .size.height, Viewcontroller .view.frame.size}; [self pushviewcontroller:viewcontroller animated:NO]; [uiview animatewithduration:.15f animations:^{ Viewcontroller.view.frame = ( cgrect) {0, 0, self .view.bounds.size};}];}   

2. If you simply want to add a custom push, pop animation instead of a view controller stack, the following code can be used to achieve a push effect from top to bottom:

Uinavigationcontroller+customanimation.h file Ibid.

Uinavigationcontroller+customanimation.m

#import"Uinavigationcontroller+customanimation.h"-(void) Custompushviewcontroller: (Uiviewcontroller *) viewcontroller{Viewcontroller. View. frame = (CGRect) {0,-viewcontroller.view.frame.size.height, Viewcontroller.view.frame< Span class= "hljs-variable" >.size}; [self.topviewcontroller.view]; [uiview animatewithduration:.15f animations:^{ Viewcontroller.view.frame = ( cgrect) {0, 0, self .view.bounds.size};}];}    
    • Link
    • Comments
    • More
the answer is helpful to the person, has the reference value2 The answer is no help, it's the wrong answer, irrelevantly replying . Navy 1.7kNovember 24, 2012 answer

Although based on Navctrl, you can use Viewctrl Presentmodalviewcontroller without Navctrl push method. As for the speed, these systems are the default of 0.3s, the animation is the system default several.
If you need a variety of custom animation, you can customize the animation is the view, give an example http://www.cocoachina.com/bbs/read.ph ..., for the landlord reference.

    • Link
    • Comments
    • More
the answer is helpful to the person, has the reference value1 The answer is no help, it's the wrong answer, irrelevantly replying . Finnchen November 23, 2012 answer

Refer to the next http://segmentfault.com/q/10100000001 ...

    • Link
    • Comments
    • More
Write an Answer

Customizing Uinavigationcontroller push and Pop animations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.