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 12-23-2008, 08:33 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Chile
Age: 31
Posts: 28
Default Utility application template and autorotation; force flipside view to always display

Just what the post title says... I've created an application using the Utility template in order to handle two 'flippable' views. I'm not using Interface Builder at all but creating all of my interfaces by code.

I wish to handle device auto rotation but only for the main view, with the flipside view always displaying in portrait mode. If of any importance, my application has the status bar hidden and my flipside view is added through an UINavigationController (instead of using a UINavigationBar as supplied by the application template).

When implementing the shouldAutorotateToInterfaceOrientation method, it only works on the RootViewController. I tried not implementing it there, only on the main view controller but it doesn't work. So I implemented it on the RootViewController, and have conditioned its return value to the display of the flipside view. This way I can prevent the view to rotate itself when the flipside view is displayed.

This is half the solution to the problem, however. If I'm on the main view rotated to a landscape orientation and display the flipside view, it doesn't display properly. I've tried several methods to make it appear with a portrait orientation regardless of the physical orientation of the device with no luck. I've looked through several similar threads and haven't found an answer, so any help would be greatly appreciated.

Best regards,
boliva is offline   Reply With Quote
Old 12-28-2008, 04:25 AM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: Berlin, Germany
Posts: 23
Default

I played around with the utility template and have the same problem. Why does shouldAutorotateToInterfaceOrientation work only on the root controller? I thought the idea was to wire it to any UIViewController by implementing this method.

Regards
Henry
henmue is offline   Reply With Quote
Old 12-28-2008, 01:45 PM   #3 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 145
Default

I had trouble with this same thing and this is what I found:

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];

Try that out.
ambiensignal is offline   Reply With Quote
Old 02-15-2009, 02:48 AM   #4 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 41
Default

I have tried the last suggestion, but still didn't find pleasing results.

Has anyone had any luck with this?

I too would like the mainViewController to display ONLY a landscape orientation and the flipSideViewController to display ONLY a portrait orientation.

Is this possible? Thx in advance...
HoofSC is offline   Reply With Quote
Old 04-05-2009, 12:00 AM   #5 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 13
Default

Quote:
Originally Posted by HoofSC View Post
I have tried the last suggestion, but still didn't find pleasing results.

Has anyone had any luck with this?

I too would like the mainViewController to display ONLY a landscape orientation and the flipSideViewController to display ONLY a portrait orientation.

Is this possible? Thx in advance...
yup! sure is!! I was just playing around myself to make this work. this might not be the best way to do this but what I have done is set an enum value to indicate weather we are working in landscape or portrait and then implement the following:

Code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
	// Return YES for supported orientations
	switch (m_LayoutSetting) {
		case LayoutSettingPortrait:
			return (interfaceOrientation == UIInterfaceOrientationPortrait);
			break;
		case LayoutSettingLandscape:
			return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
			break;
	}
}
All you have to do when switching views is set the enum for your view controller, and call the rotate function as mentioned above.

as well: (from http://www.dejoware.com/blogpages/blog.html)

"I’ve discovered that the setOrientation message for UIDevice is only needed to get the iPhone Simulator to start with the desired orientation. It can be left out if you are testing on a device and/or for your “final” build, if you want to avoid even this one warning."

hope this helps.
lowf is offline   Reply With Quote
Reply

Bookmarks

Tags
flipside, landscape, portrait, rotation, utility

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: 265
17 members and 248 guests
14DEV, @sandris, ADY, ArtieFufkin10, bookesp, ckgni, Dani77, DarkAn, HemiMG, iDifferent, jakerocheleau, JasonR, prchn4christ, Rudy, Speed, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
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 02:49 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0