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 02-15-2011, 02:55 PM   #1 (permalink)
Registered Member
 
fernan3682's Avatar
 
Join Date: Feb 2010
Location: Valencia
Posts: 11
fernan3682 is on a distinguished road
Question Refresh ViewController on TabBarController

Hi!
This is my first post on the forum after a lot of reading.

I have a tabBarController with three viewControllers on it.
When viewController 1 is selected and I make a 90 degrees I hide the tabBar and I have to addsubview the current view to the tabBarController, otherwise a blank space appears where the tabBar was.

If now I rotate the iPhone to the previously orientation (the vertical normal position) I removeFromSuperview the view, but no view is shown on the view controller, I suppose the original view (the one before the addsubview call) should be shown, in fact if I select the second viewController and later I go back to the viewController 1 the view appears perfectly.

I donīt understand why this happens, could you help me?

Thankīs!!
fernan3682 is offline   Reply With Quote
Old 02-15-2011, 03:01 PM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

Can you post the code of where you are adding and removing the subview?
smithdale87 is offline   Reply With Quote
Old 02-16-2011, 02:08 AM   #3 (permalink)
Registered Member
 
fernan3682's Avatar
 
Join Date: Feb 2010
Location: Valencia
Posts: 11
fernan3682 is on a distinguished road
Default

Quote:
Originally Posted by smithdale87 View Post
Can you post the code of where you are adding and removing the subview?
Here is the code inside MyTabBarController (@interface MyTabBarCtrller : UITabBarController):

Code:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
{		 
	AS_TabBarAppDelegate *delegate = (AS_TabBarAppDelegate *)[[UIApplication sharedApplication] delegate];
	
	self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
	
    if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {               

		self.tabBar.hidden = TRUE;
		
		vista_AS = [delegate.tabBarController.viewControllers objectAtIndex:0];
		vista_AS.view.frame = CGRectMake(0, 0, 320, 480);
		
		[self.view addSubview:vista_AS.view];
		self.tabBarController.wantsFullScreenLayout = YES;
	}
    else
    {

		if ( (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight) )
		{
			[vista_AS.view removeFromSuperview];
			self.tabBar.hidden = FALSE;
			
			
			Vista_AS *vista = [delegate.tabBarController.viewControllers objectAtIndex:0];
			//Force call to viewWillAppear on because I init the image         to be shown on the view
                        [vista viewWillAppear:true];
		}
     }
}
fernan3682 is offline   Reply With Quote
Old 02-17-2011, 01:17 PM   #4 (permalink)
Registered Member
 
fernan3682's Avatar
 
Join Date: Feb 2010
Location: Valencia
Posts: 11
fernan3682 is on a distinguished road
Default

Any help please?
fernan3682 is offline   Reply With Quote
Reply

Bookmarks

Tags
addsubview, rotation, tabbar, tabbarcontroller, viewcontroller

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: 372
8 members and 364 guests
chemistry, cpsclicker, jeroenkeij, Kirkout, PavelMik, teebee74, whitey99
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,666
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, cpsclicker
Powered by vBadvanced CMPS v3.1.0

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