Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-14-2010, 04:34 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2010
Location: Bangalore, India
Posts: 12
bimaldas is on a distinguished road
Default Disable animation of navigation bar in iphone

I am working on a Navigation-Based Application. I have few View Controllers which I push in to Navigation Controller on different occasions. The following is the code I use to push new View Controller.

AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
[self.navigationController pushViewController:anotherViewController animated:YES];
[anotherViewController release];


One thing i noticed is that, when new view controller is pushed the navigation bar also animated (slided). I have a back button, title text and right button in navigation bar. So it look wiered when navigation bar is animated.

Is there any way around to keep the navigation bar fixed and the view is only animated when new view controller is pushed?
bimaldas is offline   Reply With Quote
Old 03-14-2010, 04:45 AM   #2 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: Northern Ireland
Posts: 54
johnblack45 is on a distinguished road
Default

Are the contents the same or are they different? If you don't mind the quite bluntness of no animation then try

Code:
[self.navigationController pushViewController:nextController animated:NO];
or make try messing around with custom animations using CATransitions there are quite a few nice provided options the one below does a fade left to right.

Code:
-(void)performTransition 
{

	CATransition *transition = [CATransition animation];
	transition.duration = 0.75;
	transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
	transition.type = kCATransitionFade;
	[self.navigationController.view.layer addAnimation:transition forKey:nil];
	
}
johnblack45 is offline   Reply With Quote
Old 03-14-2010, 07:31 AM   #3 (permalink)
Registered Member
 
Join Date: Mar 2010
Location: Bangalore, India
Posts: 12
bimaldas is on a distinguished road
Default

adding animation to viewController.view.layer will affect the navigationBar and the views in the view controller. I wanted to disable the animation of navigation bar only. I fixed it by setting animation to navigationbar.view.layer

thanks


Quote:
Originally Posted by johnblack45 View Post
Are the contents the same or are they different? If you don't mind the quite bluntness of no animation then try

Code:
[self.navigationController pushViewController:nextController animated:NO];
or make try messing around with custom animations using CATransitions there are quite a few nice provided options the one below does a fade left to right.

Code:
-(void)performTransition 
{

	CATransition *transition = [CATransition animation];
	transition.duration = 0.75;
	transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
	transition.type = kCATransitionFade;
	[self.navigationController.view.layer addAnimation:transition forKey:nil];
	
}
bimaldas is offline   Reply With Quote
Old 03-25-2010, 06:01 AM   #4 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 3
vanmo is on a distinguished road
Default

I'm trying to disable the navigation bar animation too. Please could you show how you did it by setting animation to navigationbar.view.layer?

Thanks
vanmo is offline   Reply With Quote
Old 03-26-2010, 09:02 AM   #5 (permalink)
Registered Member
 
Join Date: Mar 2010
Location: Bangalore, India
Posts: 12
bimaldas is on a distinguished road
Default

It is not disabling animation what i did. Here is the code what i wrote. try with different values for duration. Let me know if it helps.


CATransition *navTransition = [CATransition animation];
navTransition.duration = 1;
navTransition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseO ut];
navTransition.type = kCATransitionPush;
navTransition.subtype = kCATransitionPush;
[self.navigationController.navigationBar.layer addAnimation:navTransition forKey:nil];



Quote:
Originally Posted by vanmo View Post
I'm trying to disable the navigation bar animation too. Please could you show how you did it by setting animation to navigationbar.view.layer?

Thanks
bimaldas is offline   Reply With Quote
Old 03-26-2010, 02:06 PM   #6 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 3
vanmo is on a distinguished road
Default

Thanks for the response!

The same as you I want to keep the navigation bar fixed and have only the view animated when a view controller is pushed or pop for the stack.

Does this code you provided help me achieve this?
Where should I put it in my app?
vanmo is offline   Reply With Quote
Old 03-27-2010, 02:07 AM   #7 (permalink)
Registered Member
 
Join Date: Mar 2010
Location: Bangalore, India
Posts: 12
bimaldas is on a distinguished road
Default

Add the code in viewWillAppear.

Regards
bimaldas is offline   Reply With Quote
Old 03-27-2010, 07:44 AM   #8 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 3
vanmo is on a distinguished road
Default

I put it in navigationController willShowViewController which should be the same as in viewWillAppear and the navigation bar still shows the animation when pushing or popping the views. Any ideas?
vanmo is offline   Reply With Quote
Old 03-30-2010, 12:59 AM   #9 (permalink)
Registered Member
 
Join Date: Mar 2010
Location: Bangalore, India
Posts: 12
bimaldas is on a distinguished road
Default

did you try adding the code in viewWillAppear?
bimaldas is offline   Reply With Quote
Reply

Bookmarks

Tags
animation, pushviewcontroller, uiviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 343
9 members and 334 guests
akacaj, c2matrix, esoteric, givensur, HemiMG, mjnafjke, Pudding, SLIC, Techgirl-52
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,115
Posts: 402,887
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:12 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0