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

View Single Post
Old 05-26-2011, 09:48 PM   #13 (permalink)
Hakimo
iOS padawan
 
Hakimo's Avatar
 
Join Date: Apr 2011
Posts: 12
Hakimo is on a distinguished road
Default

Thanks very much for the code. I have some questions though. If I'm adding a second view, I noticed after going to the second view and going back to the root view, the screen goes white. I can only see it after deleting the line "[currentView removeFromSuperview];".

What I like to know, since the mainview is the rootview, is it necessary to remove it from view. How does this effect the memory?

And if I have to remove it from the root view, should I insert the same code on the 2nd view? As in adding a new subview? How would this effect the performance?

Hope this makes sense.

Quote:
Originally Posted by erastusnjuki View Post
Just for those who are stranded like I was ...here's some code that worked for me. with this the new view slid in
//1. Add the QuatzCore Framework from library to the Frameworks folder
//2. At the top include the header file

#import <QuartzCore/QuartzCore.h>

//3. Implement the code

yourViewController = [[YourViewController alloc]
initWithNibName:@"YourViewController"
bundle:nil];
// get the view that's currently showing
UIView *currentView = self.view;
// get the the underlying UIWindow, or the view containing the current view
UIView *theWindow = [currentView superview];

UIView *newView = yourViewController.view;

// remove the current view and replace with myView1
[currentView removeFromSuperview];
[theWindow addSubview:newView];

// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseO ut]];

[[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];
__________________
www.hakimo-studio.com
www.lcgdi.com
"Learn and Play"
Facebook | Twitter
Our Apps : Pocket Ipin
Hakimo is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,599
Threads: 94,084
Posts: 402,781
Top Poster: BrianSlick (7,990)
Welcome to our newest member, bbbsaha
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:48 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.