jkap
jkap

Reputation: 5222

iPad - UIViewController only kinda rotates

Alright, so here's the problem I'm having (it's a weird one.)

I added a new UIViewController for the app I'm building. The first view controller works perfectly, orients correctly, etc. The second one orients horribly.

This is how it looks if you start in landscape and then change orientation to portrait: landscape start portrait end

And then, if you start in portrait and switch to landscape: portrait start landscape end

It's worth noting that the button isn't a problem, it's there as a trigger for some code and doesn't need to stay correctly placed. Also, switching tabs makes the orientation display correctly, but it breaks as soon as you switch again.

I have absolutely no idea why this is happening. The only code I've added to this view controller is an IBAction that doesn't have any bearing (I commented it out to be sure.) Any ideas?

Thanks,
jkap

Upvotes: 0

Views: 222

Answers (1)

empirex15
empirex15

Reputation: 11

for your button try this: b

uttonReference.autoresizingMask =  UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleWidth   | 
UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleRightMargin  |
UIViewAutoresizingFlexibleTopMargin  |
UIViewAutoresizingFlexibleBottomMargin;

for every subview (component in your view) set AutoresizeMask, actualy that mask is UIViewAutoresizingNone

Upvotes: 1

Related Questions