void Initialize(UITableViewStyle navigationStyle = UITableViewStyle.Plain)
        {
            navigation = new DialogViewController(navigationStyle, null);
            navigation.TableView.AccessibilityIdentifier = "FlyoutMenu";
            var navFrame = navigation.View.Frame;

            navFrame.Width = menuWidth;
            if (Position == FlyOutNavigationPosition.Right)
            {
                navFrame.X = mainView.Frame.Width - menuWidth;
            }
            navigation.View.Frame = navFrame;
            View.AddSubview(navigation.View);
            AddChildViewController(navigation);

            TintColor = UIColor.Black;
            var version = new System.Version(UIDevice.CurrentDevice.SystemVersion);

            isIos8 = version.Major >= 8;
            isIos7 = version.Major >= 7;
            if (isIos7)
            {
                navigation.TableView.TableHeaderView =
                    new UIView(new CGRect(0, 0, 320, 22))
                {
                    BackgroundColor = UIColor.Clear
                };
            }
            navigation.TableView.TableFooterView = new UIView(new CGRect(0, 0, 100, 100))
            {
                BackgroundColor = UIColor.Clear
            };


            navigation.TableView.ScrollsToTop = false;
            shadowView = new UIView()
            {
                AccessibilityLabel = "flyOutShadowLayeLabel", IsAccessibilityElement = true
            };
            shadowView.BackgroundColor    = UIColor.Clear;
            shadowView.Layer.ShadowOffset = new CGSize(Position == FlyOutNavigationPosition.Left ? -5 : 5, -1);
            shadowView.Layer.ShadowColor  = UIColor.Black.CGColor;

            shadowView.Layer.ShadowOpacity = .75f;
            closeButton = new UIButton();
            closeButton.AccessibilityHint  = closeButton.AccessibilityIdentifier = "CloseMenu";
            closeButton.AccessibilityLabel = "Close Menu";
            closeButton.TouchUpInside     += CloseButtonTapped;

            AlwaysShowLandscapeMenu             = true;
            NavigationOpenedByLandscapeRotation = false;

            View.AddGestureRecognizer(openGesture = new UIScreenEdgePanGestureRecognizer(() => DragContentView(openGesture))
            {
                Edges = Position == FlyOutNavigationPosition.Left ? UIRectEdge.Left : UIRectEdge.Right
            });
            View.AddGestureRecognizer(closeGesture = new OpenMenuGestureRecognizer(DragContentView, shouldReceiveTouch));
        }
Exemplo n.º 2
0
        void Initialize(UIViewController navigationController = null)
        {
            NavigationViewController = navigationController ?? new UIViewController();
            NavigationViewController.View.AccessibilityIdentifier = "FlyoutMenu";

            var navFrame = NavigationViewController.View.Frame;

            navFrame.Width = menuWidth;
            if (Position == FlyOutNavigationPosition.Right)
            {
                navFrame.X = mainView.Frame.Width - menuWidth;
            }
            NavigationViewController.View.Frame = navFrame;

            View.AddSubview(NavigationViewController.View);
            AddChildViewController(NavigationViewController);

            shadowView = new UIView()
            {
                AccessibilityLabel = "flyOutShadowLayeLabel", IsAccessibilityElement = true
            };
            shadowView.BackgroundColor     = UIColor.Clear;
            shadowView.Layer.ShadowOffset  = new CGSize(Position == FlyOutNavigationPosition.Left ? -5 : 5, -1);
            shadowView.Layer.ShadowColor   = UIColor.Black.CGColor;
            shadowView.Layer.ShadowOpacity = .75f;

            closeButton = new UIButton();
            closeButton.AccessibilityHint  = closeButton.AccessibilityIdentifier = "CloseMenu";
            closeButton.AccessibilityLabel = "Close Menu";
            closeButton.TouchUpInside     += CloseButtonTapped;

            AlwaysShowLandscapeMenu             = true;
            NavigationOpenedByLandscapeRotation = false;

            View.AddGestureRecognizer(openGesture = new UIScreenEdgePanGestureRecognizer(() => DragContentView(openGesture))
            {
                Edges = Position == FlyOutNavigationPosition.Left ? UIRectEdge.Left : UIRectEdge.Right
            });
            View.AddGestureRecognizer(closeGesture = new OpenMenuGestureRecognizer(DragContentView, shouldReceiveTouch));
        }
		void Initialize(UITableViewStyle navigationStyle = UITableViewStyle.Plain)
		{
			navigation = new DialogViewController (navigationStyle, null);
			navigation.TableView.AccessibilityIdentifier = "FlyoutMenu";
			var navFrame = navigation.View.Frame;
			navFrame.Width = menuWidth;
			if (Position == FlyOutNavigationPosition.Right)
				navFrame.X = mainView.Frame.Width - menuWidth;
			navigation.View.Frame = navFrame;
			View.AddSubview(navigation.View);

			TintColor = UIColor.Black;
			var version = new System.Version(UIDevice.CurrentDevice.SystemVersion);
			isIos8 = version.Major >= 8;
			isIos7 = version.Major >= 7;
			if(isIos7){
				navigation.TableView.TableHeaderView = 
					new UIView (new CGRect (0, 0, 320, 22)) {
					BackgroundColor = UIColor.Clear
				};
			}
			navigation.TableView.TableFooterView = new UIView(new CGRect(0, 0, 100, 100)) {BackgroundColor = UIColor.Clear};


			navigation.TableView.ScrollsToTop = false;
			shadowView = new UIView(){AccessibilityLabel = "flyOutShadowLayeLabel" , IsAccessibilityElement = true};
			shadowView.BackgroundColor = UIColor.Clear;
			shadowView.Layer.ShadowOffset = new CGSize(Position == FlyOutNavigationPosition.Left ? -5 : 5, -1);
			shadowView.Layer.ShadowColor = UIColor.Black.CGColor;

			shadowView.Layer.ShadowOpacity = .75f;
			closeButton = new UIButton ();
			closeButton.AccessibilityHint = closeButton.AccessibilityIdentifier ="CloseMenu";
			closeButton.AccessibilityLabel = "Close Menu";
			closeButton.TouchUpInside += CloseButtonTapped;

			AlwaysShowLandscapeMenu = true;
			NavigationOpenedByLandscapeRotation = false;

			View.AddGestureRecognizer (openGesture = new UIScreenEdgePanGestureRecognizer(() => DragContentView (openGesture)){Edges = Position == FlyOutNavigationPosition.Left ? UIRectEdge.Left : UIRectEdge.Right});
			View.AddGestureRecognizer (closeGesture = new OpenMenuGestureRecognizer (DragContentView, shouldReceiveTouch));
		}