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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.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 01-06-2009, 12:59 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 9
Default Landscape transform outside of viewDidLoad (NEED HELP)

Please read before telling to view other threads on this matter of which I probably have already read.

I have a app that is using a tabbarcontroller with navigationcontrollers pushed onto the tabbar.

I have one particular view of which I want to give the user the option of either portrait or landscape. This is the only view I want to have that option, all other views must remain in portrait. The view in question is the detail view of navigation controller of which the user is drilling down via table views.

Based on posts here I was able to force the view to landscape via a transformation if I put the code to transform in the viewDidLoad method. The problem is that I don't want to force it but give the user the option of either portrait or landscape. When I take the code that is working fine in viewDidLoad and place it elsewhere it does not work. For instance I made a customized version of shouldAutorotateoreintatation to run the code when the device change oreintation and it does not work quite right. The view does transform and rotate. The navigation bar is rotated and displayed fine but the view it manages via a VC is rotated 90 degrees but is cut half and not quite centered correctly. Even changing the bounds and center of that view doesn't seem to fix it all up.

Here is the code I am using, please note I have tried doing the transform on the tabbar, navigation controller and just the view. The tab bar version worked fine in viewDidLoad.

Has anyone else had any success getting this to work outside of viewDidLoad,initWithFrame, or viewWillAppear??

PHP Code:
    UIScreen *screen = [UIScreen mainScreen];
    
int y screen.bounds.size.height;
    
int x screen.bounds.size.width;
            
    
myApp *appDelegate = [[UIApplication sharedApplicationdelegate];
    
UIViewController *myVC appDelegate.tabBarController;
    
UIView *myView myVC.view;
            
    
myView.bounds CGRectMake(0.00.0yx);
    
myView.center CGPointMake(2.002.00);    
            
    
CGAffineTransform landscapeTransform CGAffineTransformMakeRotation(degreesToRadian(90));
    
landscapeTransform CGAffineTransformTranslate(landscapeTransform, +80.00, +100.00);
    
myView.transform landscapeTransform;
    
myView.center CGPointMake(2.002.00);    
            
    [[
UIApplication sharedApplicationsetStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; 
IceMan is offline   Reply With Quote
Old 02-01-2009, 10:29 AM   #2 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Switzerland
Posts: 57
Default

Have a look at this thread: iPod App like view transition.

This is surely a possible solution, if you havent got one yet! Please post yours if you found a better one.

Maechi
Maechi is offline   Reply With Quote
Reply

Bookmarks

Tags
landscape, orientation, rotation, transform

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: 234
12 members and 222 guests
ADY, CKAmike, Dani77, Duncan C, HemiMG, nick.keroulis, Promo Dispenser, Punkjumper, Rudy, sacha1996, sneaky, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

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