SundayMonday
SundayMonday

Reputation: 19757

How can I adjust a UIView for landscape orientation?

I have a UITableViewController with a custom UIView as a subview. When I rotate the iPhone from portrait to landscape orientation the UIView subview rotates correctly but does not resize correctly. How can I resize the custom UIView when the device is rotated?

Upvotes: 0

Views: 2088

Answers (1)

Stuart
Stuart

Reputation: 37053

Set the UIView's autoresizingMask like so:

myView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;

This should mean that the view resizes itself automatically on rotation.

Upvotes: 2

Related Questions