0
votes

I'm trying to create a simple ios 6 app. I've added a View and a Button inside my initial view controller, which was created by story board.

I'm trying to understand how orientation works with views/buttons/images/etc.

  1. When I launch the simulator, the first problem I see is that it defaults to landscape for some reason. I would have expected the default to be portrait. How do I adjust this? In my view controller I have the following:

    -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; }

    -(BOOL) shouldAutorotate { return YES; }

    -(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationMaskPortrait; /* I get an implicit cast. I warning here too. */ }

I've also tried modifying the Supported Interface Orientations in the Summary tab to support but no luck there either.

  1. When I change the orientation through the simulator or my phone, the View disappears or becomes really thin. How do I keep the width at 100% no matter what orientation I'm in? I've attached a few screen shots.

This is how it's suppose to look: enter image description here

But when I change the orientation, this happens: enter image description hereenter image description here

1
see my answer.It may help you stackoverflow.com/questions/15443452/…Shamsudheen TK
if u are using autolayout , this answer may help you stackoverflow.com/questions/15458174/…Shamsudheen TK
awesome, thank you for the info. It's greatly helped me!user1218776
I still don't understand why my application defaults to landscape.user1218776

1 Answers

0
votes

The simulator will always launch in the first orientation listed under supported orientations in the plist. If you put landscape first it will launch in landscape mode.

For the resizing issue you will need to set a height constrain on the button. Go to storyboard , select the button, and then use the constrain menus at the botton of the storyboard view.