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 01-24-2012, 09:53 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 51
Shoopy is on a distinguished road
Default set orientation

Hi all,

Im trying to set my iPhones application to landscape mode by button event. Does someone know how this is done? Ive found [uidevice current device] set orientation but this isn't the right way.

Thanks
Shoopy is offline   Reply With Quote
Old 01-24-2012, 10:12 AM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

I personally found rotating views to be a big annoying deal, so what I do is set a value, say in NSUserDefaults, that all of the shouldAutorotate methods look at. When the appropriate button is pressed, I show an overlay screen with a graphic indicating to the user that they should rotate their device. Then I let the shouldAutorotate methods do their thing.

My setting is applied app-wide. If you only need it for a particular view, it will probably be easier just to rotate it.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-27-2012, 02:12 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 51
Shoopy is on a distinguished road
Default

thanks for the reaction BrianSlick.

hmm.. well thats a bummer. I thought it was possible to turn the view on command because i want some views in my app to only show in portrait views and the other views, my menus, in landscape view.

If I use your method then the views that i want restricted in portrait view are also allowed to switch to landscape view right?

There no way to restrict some views in portrait and other views in landscape?

Quote:
Originally Posted by BrianSlick View Post
I personally found rotating views to be a big annoying deal, so what I do is set a value, say in NSUserDefaults, that all of the shouldAutorotate methods look at. When the appropriate button is pressed, I show an overlay screen with a graphic indicating to the user that they should rotate their device. Then I let the shouldAutorotate methods do their thing.

My setting is applied app-wide. If you only need it for a particular view, it will probably be easier just to rotate it.
Shoopy is offline   Reply With Quote
Old 01-27-2012, 08:24 AM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

How did you arrive at that conclusion from what I said?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 01-27-2012, 05:20 PM   #5 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
How did you arrive at that conclusion from what I said?
BrianSlick, your above response made me laugh

For OP:

Portrait:
Code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Landscape:
Code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
EDIT: After rereading original question I realized that there seems to be two questions. One, the original question: set "to landscape mode by button event", and two in OP's response, which is: "There no way to restrict some views in portrait and other views in landscape?"

My above response answers the latter.

Last edited by DrBeak1; 01-27-2012 at 05:25 PM. Reason: clarification
DrBeak1 is offline   Reply With Quote
Old 02-08-2012, 02:38 AM   #6 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 51
Shoopy is on a distinguished road
Default

ok thanks guys. Thats all i needed to know. Just going to reorganize my app then.
Shoopy is offline   Reply With Quote
Reply

Bookmarks

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: 402
12 members and 390 guests
7twenty7, Atatator, condor304, FrankWeller, glenn_sayers, iphonedevshani, MAMN84, mraalex, PowerGoofy, QuantumDoja, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,123
Posts: 402,908
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

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