I'd like to call
[self.view setContentMode:UIViewContentModeScaleAspectFit | UIViewContentModeCenter];
where self
is an instance of UIViewController
. This doesn't seem to work; what are the direct alternatives, if any?
I'd like to call
[self.view setContentMode:UIViewContentModeScaleAspectFit | UIViewContentModeCenter];
where self
is an instance of UIViewController
. This doesn't seem to work; what are the direct alternatives, if any?
You will need to set contentMode once when the view loads and then center it in viewWillLayoutSubviews which is called upon device rotation.
The
contentMode
is not a mask; you can't use|
to combine values, you'll have to pick one.UIViewContentModeScaleAspectFit
should center the content if it doesn't fit the view.