N C
N C

Reputation: 539

How to set navigationcontroller push animation to "No" while using storyboard

I am using storyboard for a navigation based iphone application. I want viewcontrollers to navigate using "pushviewcontroller" property but at the same time I dont want them to animate. Simply I want to set their Animation property to "NO"

How can I do this using storyboard?

Upvotes: 6

Views: 1440

Answers (2)

Ben Flynn
Ben Flynn

Reputation: 18932

To expand on the answer by @azethoth creating a no animation segue is as easy as:

@interface NoAnimationSegue : UIStoryboardSegue
@end

@implementation NoAnimationSegue    
- (void)perform
{
    [[self.sourceViewController navigationController] pushViewController:self.destinationViewController animated:NO];
}    
@end

Upvotes: 6

azethoth
azethoth

Reputation: 171

As far as I know there is no way to do this declaratively. You would either manually call

[sourceController pushViewController:destination animated:NO];

Or, if you're hellbent on using the segue you could create your own subclass of UIStoryboardSegue and implement the perform method to do the above. Then in the storyboard you can use a Custom segue and put in the name of your segue subclass.

Upvotes: 2

Related Questions