testing
testing

Reputation: 20279

Restrict orientation per view controller

I want to say in each view controller which orientation he supports and restrict it to them. This is what I tried:

None of the solutions seems to work. Or do I miss something important? How can I restrict the orientation that view controller A is landscape only, view controller B is portrait only and view controller C can be shown in all available orientations?

Upvotes: 0

Views: 1051

Answers (1)

Krumelur
Krumelur

Reputation: 33048

Overriding GetSupportedInterfaceOrientations() in your view controller should solve the problem:

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations ()     {
  return UIInterfaceOrientationMask.LandscapeRight;
}

The orientations you return here will be intersected with the app's allowed orientations (project properties) or with what you allow in your app delegate. So be sure to specify all orientations there or the maximum set of orientations you want to support.

See here for documentation.

Upvotes: 1

Related Questions