|
#1
|
|||
|
|||
|
Sorry- I am waiting for my book to arrive on learning ObjC and have been learning what I can from websites and podcasts, so I don't know all the ins and outs yet. I have done a couple of simple apps so far, but can't find any sample code which actually tells you how to force landscape mode instead of portrait. Could someone tell me please?
Thank you. |
|
#2
|
|||
|
|||
|
Quote:
That's all I really remember :). EDIT: Okay, I looked at one of my random useless apps, and in the (YourProjectName)ViewController.m, you need to change some code... /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIIn terfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); You need to change UIInterfaceOrientationPortrait to either LandscapeLeft or LandscapeRight. Hope that helped! Last edited by Mew2468; 01-28-2009 at 08:52 AM.. |
|
#3
|
|||
|
|||
|
Wow! Thanks a bunch! I will look into that. I have an idea for a first app, and I needed it landscape.
I really want to add an option as to which side you want it facing (left or right). But by default, what is the general consensus? Is left or right facing preferable? [edit] Yes, tried the above "return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);" and it works a treat. Thank you
Last edited by wastedyuthe; 01-28-2009 at 09:04 AM.. |
|
#4
|
|||
|
|||
|
Quote:
* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIIn terfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); And that way, they can use either orientation. Unless you want it to only work one way. I'd go with LandscapeLeft. (The space between UIIn and terface isn't intentional...the font did it XD - it should just be UIInterfaceOrientation) Last edited by Mew2468; 01-28-2009 at 09:10 AM.. |
|
#5
|
|||
|
|||
|
Quote:
[edit] I noticed if you swap them so Right is listed before Left, the app starts off with left orientation, so it starts with which ever is listed last. Last edited by wastedyuthe; 01-28-2009 at 09:25 AM.. |
|
#6
|
|||
|
|||
|
Information like this is extremely handy and you would think it would be noted somewhere online easy to find, it might be worth noting down stuff like this as I develop for all to read.
|
|
#7
|
||||
|
||||
|
Don't make a game upside down!
Use the YouTube or Movie player as your guide. |
|
#8
|
|||
|
|||
|
Quote:
![]() [edit] read later posts- should be LandscapeRight. Last edited by wastedyuthe; 01-29-2009 at 06:44 AM.. |
|
#9
|
||||
|
||||
|
shouldAutorotateToInterfaceOrientation only allows the view to rotate, it doesn't force a landscape orientation.
To force a landscape orientation add a new entry to your Info.plist file with a key of UIInterfaceOrientation and a value of UIInterfaceOrientationLandscapeLeft or UIInterfaceOrientationLandscapeRight. |
|
#10
|
|||
|
|||
|
Quote:
But say I want to add an option in my games settings, so the user can choose which way they want- left landscape or right landscape. There is no way for that property list command to be over-ridden is there? (perhaps I am getting in way over my head here )[edit] "Most games use left (which is home button on the right)" I set it to LandscapeLeft in the property list, and the Home button is on the left not the right. So, if people prefer the Home button on the right, then I should set it to LandscapeRight. Last edited by wastedyuthe; 01-28-2009 at 03:59 PM.. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|