Discussion Forums  >  Images, Documents, File Locations

Replies: 5    Views: 156

pocket
Lost but trying
Profile
Posts: 2
Reg: Jul 04, 2012
Vancouver, BC
3,520
02/21/13 03:24 PM (12 years ago)

Different Background Image when Rotating Device

Hello, I have tried multiple renditions on the following post: http://www.buzztouch.com/forum/thread.php?tid=AF72839689AE3F3839E945D&currentPage=1 I can't seem to get it to work. I have only one use of the "BT_menu_buttons" plugin in my App so I don't even need it to be complicated to only work on certain screens. I simply want there to be four different backgrounds (2 for iPhone (P&L), 2 for iPad(P&L)). So what I need is the code that would choose the device and then change the background image based on the orientation of the device. I also need to know which file to put that code in within XCode. I have tried putting the sample code from above in various different files and with various different minor edits but can't seem to get it to work. Anyone who can help, I would be most appreciative.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/21/13 04:41 PM (12 years ago)
Well, there is a lot of code around to detect the device, and the screen and all that. I'd say start using the 'layoutScreen' method. It's documented on line 182-ish of the BT_rotatingTabBarController.m file in most projects... It will be called when someone rotates the device; whatever device. So when it's called, detect device, detect rotation, and implement what you want to see happen. Cheers! -- Smug You would use 'layoutScreen' in your plugin. So, if you want some specific behavior for ALL screens, for the moment all I can say is you'll need to change all screen plugins. Maybe someone else knows where to place code for a global effect...
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
02/21/13 09:09 PM (12 years ago)
Is your reason for doing this because of the dimension difference between landscape and portrait, or because you genuinely need different images? The way I do it is I use a square image set to center. For example my regular iPhone background image@2x would be 960x960 and centered. That way no matter the rotation, the image fills the screen without distorting. I create generally create the following background images: iPhone 5: 1136x1136 [email protected] iPhone 4: 960x960 [email protected] iPhone: 480x480 background.png iPad Retina: 2048x2048 background@2x~ipad.png iPad: 1024x1024 background~ipad.png Hope this helps.
 
pocket
Lost but trying
Profile
Posts: 2
Reg: Jul 04, 2012
Vancouver, BC
3,520
like
03/01/13 11:32 PM (12 years ago)
Thank you for the suggestions. The square image won't work (but a great idea that I hadn't thought of). I honestly can't figure out where to put the code. I am assuming it would go in the BT_screen_menubuttons.m since it isn't a tabbed view I am using. I seems like it should be so simple but everywhere I put any type of code I find, it doesn't work. And basically I need to name four files in my BT_config file in teh end as well. I have tried creating a couple of new fields "backgroundImageNameLargeDeviceP" for portrait, etc. I am unsure if just adding that to my BT_config file and then referencing an "if...iPad and rotates...then use...filename" It seems easy to me but I can't get it to work. So frustrating as the background image goes all crunched up when rotated otherwise. Thanks for any other suggestions.
 
OrchardApps
Code is Art
Profile
Posts: 115
Reg: Jan 11, 2012
Brisbane austra...
5,850
like
05/31/13 05:29 AM (12 years ago)
Hi pocket. Did you get this figured out? Unfortunately the square image isn't working for me either. I'm using the BT Design Menu and I would really like to have my background image resizing correctly as I don't want to lock the device orientation.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
05/31/13 05:58 AM (12 years ago)
you would put it in it's own method. -(void)viewDidLoad { blah blah blah... } -(void)viewWillAppear { blah blah blah... } -(void)LayoutScreen { [self doSomething]; } Hope this helps! Cheers! -- Smug
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.