Beispiel #1
0
        public static UIViewController GetViewController(this Widget control, bool force = true)
        {
            if (control == null)
            {
                return(null);
            }

            var iosView = control.Handler as IIosViewControllerSource;

            if (iosView != null)
            {
                var controller = iosView.Controller;
                if (controller != null)
                {
                    return(controller);
                }
            }
            if (force)
            {
                var view = control.GetContainerView();
                if (view != null)
                {
                    var viewcontroller = new RotatableViewController {
                        View = view
                    };
                    if (iosView != null)
                    {
                        iosView.Controller = viewcontroller;
                    }
                    return(viewcontroller);
                }
            }
            return(null);
        }
Beispiel #2
0
		public static UIViewController GetViewController(this Widget control, bool force = true)
		{
			if (control == null)
				return null;
			
			var iosView = control.Handler as IIosViewControllerSource;
			if (iosView != null)
			{
				var controller = iosView.Controller;
				if (controller != null)
					return controller;
			}
			if (force)
			{
				var view = control.GetContainerView();
				if (view != null)
				{
					var viewcontroller = new RotatableViewController { View = view };
					if (iosView != null)
						iosView.Controller = viewcontroller;
					return viewcontroller;
				}
			}
			return null;
		}