Subclassing UINavigationController

OsmanEsenOsmanEsen DKMember
edited March 2016 in Xamarin.iOS

Hi.

I have a storyboard consisting of a UINavigationController as an initial view controller and several UIViewControllers. I want one of my UIViewControllers to lock screen orientation to portrait, but according to a short research, I need to subclass my UINavigationController. Is there any coding examples of how to subclass a UINavigationController ?.

Answers

  • trinnguyentrinnguyen VNMember ✭✭

    try this:

    [Register("CustomNavigationController")]
    public class CustomNavigationController : UINavigationController
    {
        public CustomNavigationController(IntPtr handler) : base(handler)
        {
        }
    
        public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
        {
            //return orientation here
        }
    }
    
Sign In or Register to comment.