PDA

View Full Version : iPhone orientation




mbpc2d.user
Apr 6, 2008, 02:23 PM
I have it so I can rotate my program, but how can I set the default orientation?



iphoneGuy
Apr 6, 2008, 02:52 PM
I have it so I can rotate my program, but how can I set the default orientation?

You can not set the default orientation.

mbpc2d.user
Apr 6, 2008, 04:15 PM
hmm, that presents a problem lol. thanks dude

iphoneGuy
Apr 6, 2008, 04:42 PM
hmm, that presents a problem lol. thanks dude

You could however get the current orientation and if it is not the way you like it alert the user to roatet the device.. But your UI should just make them realize that they need the device rotated such as the Kalimba sample.

mbpc2d.user
Apr 6, 2008, 06:55 PM
yeah, I thought about that. the kimbala and bubblelevel apps both maintain there portrait orientations and since nothing moves or rotates, it works. but i was hoping to be able to allow my app run in landscape mode and allow the user to choose landscapeleft or lanscaperight. but i guess i could just keep it portrait and force the user to hold it one way, and since thats how apples examples are, they shouldn't have a problem with that style.

nmelo
Jul 25, 2008, 06:12 PM
well..in fact you can set the "default" orientation for the application...

Check it out:

http://developer.apple.com/iphone/library/codinghowtos/UserExperience/index.html#GENERAL-START_MY_APPLICATION_IN_LANDSCAPE_MODE

You need to edit your Info.plist file to add the UIInterfaceOrientation key with the appropriate value (UIInterfaceOrientationLandscapeRight or UIInterfaceOrientationLandscapeLeft).

but I guess what you are asking is how to have a view to be "landscape" when your application is set to portrait mode view? well...I'm trying to do the same thing...the youtube application behaves this way which is kinda curious.

If someone comes up with something please post!! :rolleyes:

ximxc2
Sep 3, 2008, 06:11 PM
Actually you can change it with this statement

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];

The UIDevice's orientation property is read-only and the compilator marks a warning... but works fine ^_^.
Maybe there's a better way to do it, but I couldn't find another solution.

Regards,
GC

deepak832
Jan 20, 2009, 01:34 AM
Hi all,

I am implementing orientation in my application view. But when my device rotate to left or right with that my image is also rotates but that time a blank black view is display in 1/4 part of the screen, i don't know why.
I am just doing
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}


I am attaching the screen which i am getting after rotation, in that the corner black frame is displaying after rotation, and i don't know why ? and that frame cut my half image.


Please help me how can i solve this problem.


Thanks in Advance,
Deepak
www.umundo.com

nmelo
Jan 21, 2009, 06:15 AM
deepak, try resizing your image_view to fit the landscape mode. The OS merely handles the rotation but does not resize your screen or places your UI controls in the correct place, you need to handle that manually.
hope it helps!

Nelson

deepak832
Jan 22, 2009, 04:58 AM
Acutely i used UIScrollView and added the image in that like [scrollView addSubview:imageView]; it works fine, but i used zooming and orientation both.. my orientation code is working fine with the help of your reply. But when i done zoom with scale 3-4 and if then used left or right orientation then my image get out from my scrollview.

I don't know why..



Thanks,
Deepak
www.umundo.com

PhoneyDeveloper
Jan 22, 2009, 09:56 AM
@deepak, You need to set the autoresizeMask for your views so they're resized when the device rotates.

deepak832
Jan 23, 2009, 07:12 AM
Hi,
I used all that in my code like
scrollView.autoresizingMask =
( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
scrollView.maximumZoomScale = 5;
scrollView.minimumZoomScale = 1;
scrollView.clipsToBounds = YES;
scrollView.autoresizesSubviews = YES;

But problem is same..


Thanks

PhoneyDeveloper
Jan 23, 2009, 08:55 AM
What about the autoresizingMask for the imageView?

Ashli
Feb 3, 2009, 01:32 AM
Hello,
In my iPhone application i used zooming and orientation both. But at the time of orientation i am giving back button only when in UIDeviceOrientationPortrait mode, not with other mode.
My application get failed because of above region.




Ashli

todizara
Mar 10, 2011, 02:42 PM
hello!

I have an application with three views, the first two buttons to go in the other two. I would like one of the views will be displayed in landscape.

I tried [[UIDevice currentDevice] setOrientation: UIInterfaceOrientationLandscapeRight], but it not work.

I set its direction in interface builder but he is still in portrait.

If you have an idea, I know because I am confused here.

nickculbertson
Mar 10, 2011, 03:05 PM
hello!

I have an application with three views, the first two buttons to go in the other two. I would like one of the views will be displayed in landscape.

I tried [[UIDevice currentDevice] setOrientation: UIInterfaceOrientationLandscapeRight], but it not work.

I set its direction in interface builder but he is still in portrait.

If you have an idea, I know because I am confused here.

try

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

Nick