public UIPageViewControllerSpineLocation GetSpineLocation (UIPageViewController pageViewController, UIInterfaceOrientation orientation)
		{
			if (orientation == UIInterfaceOrientation.Portrait || UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
				UIViewController currentViewController = pageViewController.ViewControllers [0];
				pageViewController.SetViewControllers (
					new [] { currentViewController },
					UIPageViewControllerNavigationDirection.Forward,
					true, null
				);

				pageViewController.DoubleSided = false;
				return UIPageViewControllerSpineLocation.Min;
			}

			var dataViewController = (DataViewController)pageViewController.ViewControllers [0];
			var indexOfCurrentViewController = modelController.IndexOfViewController (dataViewController);
			UIViewController[] viewControllers = null;

			if (indexOfCurrentViewController == 0 || indexOfCurrentViewController % 2 == 0) {
				UIViewController nextViewController = modelController.GetNextViewController (pageViewController, dataViewController);
				viewControllers = new [] { dataViewController, nextViewController };
			} else {
				UIViewController previousViewController = modelController.GetPreviousViewController (pageViewController, dataViewController);
				viewControllers = new[] { dataViewController, previousViewController };
			}

			pageViewController.SetViewControllers (viewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);
			return UIPageViewControllerSpineLocation.Mid;
		}
Пример #2
0
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     base.DidRotate (fromInterfaceOrientation);
     foreach (var x in TableView.VisibleCells) {
         ((ContactListScreenCell)x).Rotate ();
     }
 }
Пример #3
0
		/// <summary>
		/// A helper method to position the controls appropriately, based on the 
		/// orientation
		/// </summary>
		protected void PositionControls (UIInterfaceOrientation toInterfaceOrientation)
		{
			// depending one what orientation we start in, we want to position our controls
			// appropriately
			switch (toInterfaceOrientation) {
				// if we're switching to landscape
				case UIInterfaceOrientation.LandscapeLeft:
				case UIInterfaceOrientation.LandscapeRight:
					
					// reposition the buttons
					button1.Frame = new System.Drawing.RectangleF (10, 10, 100, 33);
					button2.Frame = new System.Drawing.RectangleF (10, 200, 100, 33);
					
					// reposition the image
					image.Frame = new System.Drawing.RectangleF (240, 25, image.Frame.Width, image.Frame.Height);
					
					break;
				
				// we're switching back to portrait
				case UIInterfaceOrientation.Portrait:
				case UIInterfaceOrientation.PortraitUpsideDown:
					
					// reposition the buttons
					button1.Frame = new System.Drawing.RectangleF (10, 10, 100, 33);
					button2.Frame = new System.Drawing.RectangleF (200, 10, 100, 33);
					
					// reposition the image
					image.Frame = new System.Drawing.RectangleF (20, 150, this.image.Frame.Width, this.image.Frame.Height);
					
					break;
			}
		}
        public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
        {
            base.DidRotate (fromInterfaceOrientation);

            scrollView.Frame = new RectangleF(0,0,baseView.Bounds.Width,baseView.Bounds.Height-36);
            pageControl.Frame = new RectangleF(0,baseView.Bounds.Height-36,baseView.Bounds.Width,36);

            int count = pageControl.Pages;

            RectangleF scrollFrame = scrollView.Frame;
            scrollFrame.Width = scrollFrame.Width * count;
            scrollView.ContentSize = scrollFrame.Size;

            for (int i=0; i<count; i++)
            {
                RectangleF frame = scrollView.Frame;
                PointF location = new PointF();
                location.X = frame.Width * i;

                frame.Location = location;

                scrollView.Subviews[i].Frame = frame;

            }

            float pageOffset = scrollView.Frame.Width*pageControl.CurrentPage;

            PointF p = new PointF(pageOffset, 0);
            scrollView.SetContentOffset(p,true);
        }
Пример #5
0
 public override bool ShouldHideViewController(UISplitViewController svc, UIViewController viewController, UIInterfaceOrientation inOrientation)
 {
     //return true; // always hide
     //return true; // never hide
     return inOrientation == UIInterfaceOrientation.Portrait
         || inOrientation == UIInterfaceOrientation.PortraitUpsideDown;
 }
Пример #6
0
		/// <summary>
		/// is called when the OS is going to rotate the application. It handles rotating the status bar
		/// if it's present, as well as it's controls like the navigation controller and tab bar, but you 
		/// must handle the rotation of your view and associated subviews. This call is wrapped in an 
		/// animation block in the underlying implementation, so it will automatically animate your control
		/// repositioning.
		/// </summary>
		public override void WillAnimateRotation (UIInterfaceOrientation toInterfaceOrientation, double duration)
		{
			base.WillAnimateRotation (toInterfaceOrientation, duration);
			
			// call our helper method to position the controls
			PositionControls (toInterfaceOrientation);
		}
Пример #7
0
 /// <summary>
 /// Only allow iPad application to rotate, iPhone is always portrait
 /// </summary>
 public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
 {
     if (AppDelegate.IsPad)
         return true;
     else
         return toInterfaceOrientation == UIInterfaceOrientation.Portrait;
 }
Пример #8
0
 public ExEnEmTouchScaler(UIInterfaceOrientation orientation, Point renderbufferSize, Point deviceSize)
 {
     this.orientation = orientation;
     this.renderbufferSize = renderbufferSize;
     this.deviceSize = deviceSize;
     Recalculate();
 }
Пример #9
0
 public override void DidRotate(UIInterfaceOrientation orientation)
 {
     base.DidRotate(orientation);
     View.SetNeedsDisplay();
     Console.WriteLine("Hypnosis View did rotate - frame" + View.Frame.ToString());
     Console.WriteLine("Hypnosis View did rotate - bounds" + View.Frame.ToString());
 }
Пример #10
0
 public void UpdatePreviewRotation(UIInterfaceOrientation orientation)
 {
     //Re-size camera feed based on orientation
     if (previewLayer == null) return;
     previewLayer.Connection.VideoOrientation = configDicByRotationChanged[orientation];
     previewLayer.Frame = rootView.Bounds;
 }
		public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
		{
			if (ViewModel is BaseViewModel)
			{
				((BaseViewModel)ViewModel).WaitForReady(() => InvokeOnMainThread(ViewModelReady));
			}
		}
Пример #12
0
        public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
        {
            base.DidRotate (fromInterfaceOrientation);

            WebView.Frame = new RectangleF (0f * Device.screenWidthP, 0f * Device.screenHeightP, 100f * Device.screenWidthP, 100f * Device.screenHeightP);
            WebView.Reload ();
        }
		public override void DidRotate (UIInterfaceOrientation fromInterfaceOrientation)
		{
			base.DidRotate (fromInterfaceOrientation);

			// update the camera orientation
			stillCamera.OutputImageOrientation = InterfaceOrientation;
		}
Пример #14
0
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     base.DidRotate (fromInterfaceOrientation);
     if (aboutScreenView != null) {
         aboutScreenView.Rotate ();
     }
 }
        public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
        {
            CheckOrientation ();

            Console.WriteLine("Rotate From {0} to {1} with frame {2}",fromInterfaceOrientation, InterfaceOrientation, this.View.Frame);
            base.DidRotate (fromInterfaceOrientation);
        }
Пример #16
0
        public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
        {
            var f = this.View.Frame;

            _player.View.Frame = new Rectangle(0,0,(int)f.Height,(int)f.Width);
            return true;
        }
Пример #17
0
        public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
        {
            base.WillRotate (toInterfaceOrientation, duration);

            if (googleAdView != null)
                googleAdView.AdSize = ForOrientation (toInterfaceOrientation);
        }
        void UpdateInterfaceOrientation(UIInterfaceOrientation interfaceOrientation)
        {
            _scannerSession.InterfaceOrientation = interfaceOrientation;

            var captureLayer = _scannerSession.CaptureLayer;

            captureLayer.Frame = View.Bounds;

            switch (interfaceOrientation) {
            case UIInterfaceOrientation.Portrait:
                captureLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.Portrait;
                break;
            case UIInterfaceOrientation.PortraitUpsideDown:
                captureLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.PortraitUpsideDown;
                break;
            case UIInterfaceOrientation.LandscapeLeft:
                captureLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.LandscapeLeft;
                break;
            case UIInterfaceOrientation.LandscapeRight:
                captureLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.LandscapeRight;
                break;
            default:
                break;
            }
        }
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     base.DidRotate(fromInterfaceOrientation);
     TableView.BeginUpdates();
     TableView.TableHeaderView = HeaderView;
     TableView.EndUpdates();
 }
Пример #20
0
		public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
		{
			base.DidRotate(fromInterfaceOrientation);

			foreach(var v in ScrollView.Subviews) v.RemoveFromSuperview();
			CreateMenu();
		}
Пример #21
0
		public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
		{
			// Return true for supported orientations
			_moviePlayer.View.Frame = this.View.Frame;
			
			return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
		}
Пример #22
0
 public override System.Drawing.SizeF SizeForItemsInInterfaceOrientation(GMGridView.GMGridView gridView, UIInterfaceOrientation orientation)
 {
     SizeF size;
     //Console.WriteLine("SizeForItemsInInterfaceOrientation");
     if (MainViewController.UserInterfaceIdiomIsPhone) {
         if (orientation == UIInterfaceOrientation.LandscapeLeft || orientation == UIInterfaceOrientation.LandscapeRight)
         {
             size = new SizeF(170.0f, 135.0f);
         }
         else
         {
             size = new SizeF(140f, 110f);
         }
     }
     else
     {
         if (orientation == UIInterfaceOrientation.LandscapeLeft || orientation == UIInterfaceOrientation.LandscapeRight)
         {
             size = new SizeF(285.0f, 205.0f);
         }
         else
         {
             size = new SizeF(230.0f, 175.0f);
         }
     }
     Console.WriteLine("Size: {0}; {1}", size.Width, size.Height);
     return size;
 }
        public UIPageViewControllerSpineLocation GetSpineLocation(UIPageViewController pageViewController, UIInterfaceOrientation orientation)
        {
            UIViewController currentViewController;
            UIViewController[] viewControllers;

            if (orientation == UIInterfaceOrientation.Portrait || orientation == UIInterfaceOrientation.PortraitUpsideDown || UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
                // In portrait orientation or on iPhone: Set the spine position to "min" and the page view controller's view controllers array to contain just one view controller.
                // Setting the spine position to 'UIPageViewControllerSpineLocation.Mid' in landscape orientation sets the doubleSided property to true, so set it to false here.
                currentViewController = pageViewController.ViewControllers [0];
                viewControllers = new [] { currentViewController };
                pageViewController.SetViewControllers (viewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);

                pageViewController.DoubleSided = false;

                return UIPageViewControllerSpineLocation.Min;
            }

            // In landscape orientation: Set set the spine location to "mid" and the page view controller's view controllers array to contain two view controllers.
            // If the current page is even, set it to contain the current and next view controllers; if it is odd, set the array to contain the previous and current view controllers.
            currentViewController = pageViewController.ViewControllers [0];

            int index = ModelController.IndexOf ((DataViewController)currentViewController);
            if (index == 0 || index % 2 == 0) {
                var nextViewController = ModelController.GetNextViewController (pageViewController, currentViewController);
                viewControllers = new [] { currentViewController, nextViewController };
            } else {
                var previousViewController = ModelController.GetPreviousViewController (pageViewController, currentViewController);
                viewControllers = new [] { previousViewController, currentViewController };
            }

            pageViewController.SetViewControllers (viewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);

            return UIPageViewControllerSpineLocation.Mid;
        }
        public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
        {
            base.DidRotate(fromInterfaceOrientation);

            UpdateGUI();
            UpdateTableView();
        }
		public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
		{
			if (UserInterfaceIdiomIsPhone)
				return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);

			return true;
		}
		public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
		{
			if (toInterfaceOrientation == UIInterfaceOrientation.LandscapeLeft)
				return true;
			else if (toInterfaceOrientation == UIInterfaceOrientation.LandscapeRight)
				return true;
			return false;
		}
 public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
 {
     base.WillRotate(toInterfaceOrientation, duration);
     UIView.BeginAnimations( "Position" );
     UIView.SetAnimationDuration(duration);
     LayoutViews(Helper.ScreenBoundsDependOnOrientation(toInterfaceOrientation));
     UIView.CommitAnimations();
 }
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     // Refresh Chart rotating the device
     chart.RemoveFromSuperview();
     chart.Frame = View.Frame;
     View.AddSubview(chart);
     chart.DoInvalidate();
 }
Пример #29
0
        public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
        {
            base.DidRotate (fromInterfaceOrientation);

            if (centerButton != null){
                this.View.BringSubviewToFront(centerButton);
            }
        }
Пример #30
0
 public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
 {
     if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
         return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
     } else {
         return (toInterfaceOrientation == UIInterfaceOrientation.Portrait);
     }
 }
            public override bool ShouldHideViewController(UISplitViewController svc, UIViewController viewController, UIInterfaceOrientation inOrientation)
            {
                bool willHideViewController;

                switch (_flyoutPresentedDefaultState)
                {
                case FlyoutLayoutBehavior.Split:
                    willHideViewController = false;
                    break;

                case FlyoutLayoutBehavior.Popover:
                    willHideViewController = true;
                    break;

                case FlyoutLayoutBehavior.SplitOnPortrait:
                    willHideViewController = !(inOrientation == UIInterfaceOrientation.Portrait || inOrientation == UIInterfaceOrientation.PortraitUpsideDown);
                    break;

                default:
                    willHideViewController = inOrientation == UIInterfaceOrientation.Portrait || inOrientation == UIInterfaceOrientation.PortraitUpsideDown;
                    break;
                }
                return(willHideViewController);
            }
 bool ShouldShowMaster(UIInterfaceOrientation orientation)
 {
     // Returns true if master view should be shown directly embedded in the splitview, instead of hidden in a popover.
     return(IsLandscape() ? _showsMasterInLandscape : _showsMasterInPortrait);
 }
        public void DidRotate(UIInterfaceOrientation orientation)
        {
            ResizePreview(orientation);

            LayoutSubviews();
        }
        void LayoutSubviews(UIInterfaceOrientation theOrientation, bool animate)
        {
            // this is mostly for video playback.  if a video is playing, we need
            // to make sure that it remains on the top when a rotation occurs
            UIView topView = null;

            if (View.Subviews.Count() > 0)
            {
                topView = View.Subviews.Last();
            }

            if (_reconfigurePopup)
            {
                ReconfigureForMasterInPopover(!ShouldShowMaster(theOrientation));
            }

            // Layout the master, detail and divider views appropriately, adding/removing subviews as needed.
            // First obtain relevant geometry.
            SizeF fullSize = SplitViewSizeForOrientation(theOrientation);
            float width    = fullSize.Width;
            float height   = fullSize.Height;

            // Layout the master, divider and detail views.
            RectangleF newFrame = new RectangleF(0, 0, width, height);
            UIView     view;
            bool       shouldShowMaster = ShouldShowMaster(theOrientation);
            bool       masterFirst = MasterBeforeDetail;
            RectangleF masterRect, dividerRect, detailRect;

            if (Vertical)
            {
                if (masterFirst)
                {
                    if (!ShouldShowMaster())
                    {
                        // Move off-screen.
                        newFrame.X -= (SplitPosition + SplitWidth);
                    }

                    newFrame.Width = SplitPosition;
                    masterRect     = newFrame;

                    newFrame.X    += newFrame.Width;
                    newFrame.Width = SplitWidth;
                    dividerRect    = newFrame;

                    newFrame.X    += newFrame.Width;
                    newFrame.Width = width - newFrame.X;
                    detailRect     = newFrame;
                }
                else
                {
                    if (!ShouldShowMaster())
                    {
                        // Move off-screen.
                        newFrame.Width += (SplitPosition + SplitWidth);
                    }

                    newFrame.Width -= (SplitPosition + SplitWidth);
                    detailRect      = newFrame;

                    newFrame.X    += newFrame.Width;
                    newFrame.Width = SplitWidth;
                    dividerRect    = newFrame;

                    newFrame.X    += newFrame.Width;
                    newFrame.Width = SplitPosition;
                    masterRect     = newFrame;
                }

                // Position master.
                view = _masterViewController.View;
                if (view != null)
                {
                    view.Frame = masterRect;
                    if (view.Superview == null)
                    {
                        _masterViewController.ViewWillAppear(false);
                        View.AddSubview(view);
                        _masterViewController.ViewDidAppear(false);
                    }
                }

                // Position divider.
                view       = DividerView;
                view.Frame = dividerRect;
                if (view.Superview == null)
                {
                    View.AddSubview(view);
                }

                // Position detail.
                view = _detailViewController.View;
                if (view != null)
                {
                    view.Frame = detailRect;
                    if (view.Superview == null)
                    {
                        View.InsertSubviewAbove(view, _masterViewController.View);
                    }
                    else
                    {
                        View.BringSubviewToFront(view);
                    }
                }
            }
            else
            {
                if (masterFirst)
                {
                    if (!ShouldShowMaster())
                    {
                        // Move off-screen.
                        newFrame.Y -= (SplitPosition + SplitWidth);
                    }

                    newFrame.Height = SplitPosition;
                    masterRect      = newFrame;

                    newFrame.Y     += newFrame.Height;
                    newFrame.Height = SplitWidth;
                    dividerRect     = newFrame;

                    newFrame.Y     += newFrame.Height;
                    newFrame.Height = height - newFrame.Y;
                    detailRect      = newFrame;
                }
                else
                {
                    if (!ShouldShowMaster())
                    {
                        // Move off-screen.
                        newFrame.Height += (SplitPosition + SplitWidth);
                    }

                    newFrame.Height -= (SplitPosition + SplitWidth);
                    detailRect       = newFrame;

                    newFrame.Y     += newFrame.Height;
                    newFrame.Height = SplitWidth;
                    dividerRect     = newFrame;

                    newFrame.Y     += newFrame.Height;
                    newFrame.Height = SplitPosition;
                    masterRect      = newFrame;
                }

                // Position master.
                view = _masterViewController.View;
                if (view != null)
                {
                    view.Frame = masterRect;
                    if (view.Superview == null)
                    {
                        _masterViewController.ViewWillAppear(false);
                        View.AddSubview(view);
                        _masterViewController.ViewDidAppear(false);
                    }
                }

                // Position divider.
                view       = DividerView;
                view.Frame = dividerRect;
                if (view.Superview == null)
                {
                    View.AddSubview(view);
                }

                // Position detail.
                view = _detailViewController.View;
                if (view == null)
                {
                    view.Frame = detailRect;
                    if (view.Superview == null)
                    {
                        View.InsertSubviewAbove(view, _masterViewController.View);
                    }
                    else
                    {
                        View.BringSubviewToFront(view);
                    }
                }
            }

            // Create corner views if necessary.
            MGSplitCornersView leadingCorners;             // top/left of screen in Vertical/horizontal split.
            MGSplitCornersView trailingCorners;            // bottom/right of screen in Vertical/horizontal split.

            if (_cornerViews == null)
            {
                leadingCorners = new MGSplitCornersView();
                leadingCorners.SetSplitViewController(this);
                leadingCorners.CornerBackgroundColor = _defaultCornerColor;
                leadingCorners.CornerRadius          = _defaultCornerRadius;
                trailingCorners = new MGSplitCornersView();
                trailingCorners.SetSplitViewController(this);
                trailingCorners.CornerBackgroundColor = _defaultCornerColor;
                trailingCorners.CornerRadius          = _defaultCornerRadius;
                _cornerViews = new MGSplitCornersView[2] {
                    leadingCorners, trailingCorners
                };
            }
            else
            {
                leadingCorners  = _cornerViews[0];
                trailingCorners = _cornerViews[1];
            }

            // Configure and layout the corner-views.
            leadingCorners.CornersPosition   = (Vertical) ? MGCornersPosition.LeadingVertical : MGCornersPosition.LeadingHorizontal;
            trailingCorners.CornersPosition  = (Vertical) ? MGCornersPosition.TrailingVertical : MGCornersPosition.TrailingHorizontal;
            leadingCorners.AutoresizingMask  = (Vertical) ? UIViewAutoresizing.FlexibleBottomMargin : UIViewAutoresizing.FlexibleRightMargin;
            trailingCorners.AutoresizingMask = (Vertical) ? UIViewAutoresizing.FlexibleTopMargin : UIViewAutoresizing.FlexibleLeftMargin;

            float      x, y, cornersWidth, cornersHeight;
            RectangleF leadingRect, trailingRect;
            float      radius = leadingCorners.CornerRadius;

            if (Vertical)               // left/right split
            {
                cornersWidth  = (radius * 2.0f) + SplitWidth;
                cornersHeight = radius;
                x             = ((shouldShowMaster) ? ((masterFirst) ? SplitPosition : width - (SplitPosition + SplitWidth)) : (0 - SplitWidth)) - radius;
                y             = 0;
                leadingRect   = new RectangleF(x, y, cornersWidth, cornersHeight);                        // top corners
                trailingRect  = new RectangleF(x, (height - cornersHeight), cornersWidth, cornersHeight); // bottom corners
            }
            else                                                                                          // top/bottom split
            {
                x             = 0;
                y             = ((shouldShowMaster) ? ((masterFirst) ? SplitPosition : height - (SplitPosition + SplitWidth)) : (0 - SplitWidth)) - radius;
                cornersWidth  = radius;
                cornersHeight = (radius * 2.0f) + SplitWidth;
                leadingRect   = new RectangleF(x, y, cornersWidth, cornersHeight);                      // left corners
                trailingRect  = new RectangleF((width - cornersWidth), y, cornersWidth, cornersHeight); // right corners
            }

            leadingCorners.Frame  = leadingRect;
            trailingCorners.Frame = trailingRect;

            // Ensure corners are visible and frontmost.
            if (leadingCorners.Superview == null)
            {
                View.InsertSubviewAbove(leadingCorners, _detailViewController.View);
                View.InsertSubviewAbove(trailingCorners, _detailViewController.View);
            }
            else
            {
                View.BringSubviewToFront(leadingCorners);
                View.BringSubviewToFront(trailingCorners);
            }

            if (topView != null)
            {
                topView.Superview.BringSubviewToFront(topView);
            }

//			if (IsLandscape())
//				View.Frame = new RectangleF(0, 20, View.Frame.Width, View.Frame.Height);
//			else
//				View.Frame = new RectangleF(0, 20, View.Frame.Width, View.Frame.Height);
        }
Пример #35
0
 /// <summary>
 /// Handles device orientation changes.
 /// </summary>
 /// <param name="fromInterfaceOrientation">The previous interface orientation.</param>
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     base.DidRotate(fromInterfaceOrientation);
     this.plotView.InvalidatePlot(false);
 }
Пример #36
0
 public bool IsPortrait(UIInterfaceOrientation orientation)
 {
     return(orientation == UIInterfaceOrientation.Portrait || orientation == UIInterfaceOrientation.PortraitUpsideDown);
 }
Пример #37
0
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     _ignoreNativeScrolling = false;
     View.SetNeedsLayout();
 }
        public UIPageViewControllerSpineLocation GetSpineLocation(UIPageViewController pageViewController, UIInterfaceOrientation orientation)
        {
            UIViewController currentViewController;

            UIViewController[] viewControllers;

            if (orientation == UIInterfaceOrientation.Portrait || orientation == UIInterfaceOrientation.PortraitUpsideDown || UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
            {
                // In portrait orientation or on iPhone: Set the spine position to "min" and the page view controller's view controllers array to contain just one view controller.
                // Setting the spine position to 'UIPageViewControllerSpineLocation.Mid' in landscape orientation sets the doubleSided property to true, so set it to false here.
                currentViewController = pageViewController.ViewControllers[0];
                viewControllers       = new[] { currentViewController };
                pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);

                pageViewController.DoubleSided = false;

                return(UIPageViewControllerSpineLocation.Min);
            }

            // In landscape orientation: Set set the spine location to "mid" and the page view controller's view controllers array to contain two view controllers.
            // If the current page is even, set it to contain the current and next view controllers; if it is odd, set the array to contain the previous and current view controllers.
            currentViewController = pageViewController.ViewControllers[0];

            int index = ModelController.IndexOf((DataViewController)currentViewController);

            if (index == 0 || index % 2 == 0)
            {
                var nextViewController = ModelController.GetNextViewController(pageViewController, currentViewController);
                viewControllers = new[] { currentViewController, nextViewController };
            }
            else
            {
                var previousViewController = ModelController.GetPreviousViewController(pageViewController, currentViewController);
                viewControllers = new[] { previousViewController, currentViewController };
            }

            pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);

            return(UIPageViewControllerSpineLocation.Mid);
        }
Пример #39
0
 public override bool ShouldHideViewController(UISplitViewController svc, UIViewController viewController, UIInterfaceOrientation inOrientation)
 {
     return(false);
 }
Пример #40
0
            public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
            {
                base.DidRotate(fromInterfaceOrientation);

                View.SetNeedsLayout();
            }
        private static UICollectionViewFlowLayout CollectionViewFlowLayoutForOrientation(UIInterfaceOrientation orientation, GMImagePickerController picker)
        {
            nfloat screenWidth;
            nfloat screenHeight;

            //Ipad popover is not affected by rotation!
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                screenWidth  = picker.View.Bounds.Width;
                screenHeight = picker.View.Bounds.Height;
            }
            else
            {
                var insets = UIEdgeInsets.Zero;
                if (picker.View.RespondsToSelector(new ObjCRuntime.Selector("safeAreaInsets")))
                {
                    insets = picker.View.SafeAreaInsets;
                }
                var horizontalInsets = insets.Right + insets.Left;
                var verticalInsets   = insets.Bottom + insets.Top;

                if (UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.LandscapeLeft ||
                    UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.LandscapeRight)
                {
                    screenHeight = picker.View.Bounds.Width - horizontalInsets;
                    screenWidth  = picker.View.Bounds.Height - verticalInsets;
                }
                else
                {
                    screenWidth  = picker.View.Bounds.Width - horizontalInsets;
                    screenHeight = picker.View.Bounds.Height - verticalInsets;
                }
            }

            if ((UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) ||
                (UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.Portrait ||
                 UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.PortraitUpsideDown))
            {
                if (_portraitLayout == null)
                {
                    var cellTotalUsableWidth = screenWidth - (picker.ColsInPortrait - 1) * picker.MinimumInteritemSpacing;
                    var itemSize             = new CGSize(cellTotalUsableWidth / picker.ColsInPortrait, cellTotalUsableWidth / picker.ColsInPortrait);
                    var cellTotalUsedWidth   = (double)itemSize.Width * picker.ColsInPortrait;
                    var spaceTotalWidth      = screenWidth - cellTotalUsedWidth;
                    var spaceWidth           = spaceTotalWidth / (picker.ColsInPortrait - 1);

                    _portraitLayout = new UICollectionViewFlowLayout {
                        MinimumInteritemSpacing = picker.MinimumInteritemSpacing,
                        ItemSize           = itemSize,
                        MinimumLineSpacing = (nfloat)spaceWidth
                    };

                    if (_portraitLayout.RespondsToSelector(new ObjCRuntime.Selector("sectionInsetReference")))
                    {
                        _portraitLayout.SectionInsetReference = UICollectionViewFlowLayoutSectionInsetReference.SafeArea;
                    }
                }
                return(_portraitLayout);
            }
            else
            {
                if (_landscapeLayout == null)
                {
                    var cellTotalUsableWidth = screenHeight - (picker.ColsInLandscape - 1) * picker.MinimumInteritemSpacing;
                    var itemSize             = new CGSize(cellTotalUsableWidth / picker.ColsInLandscape, cellTotalUsableWidth / picker.ColsInLandscape);
                    var cellTotalUsedWidth   = (double)itemSize.Width * picker.ColsInLandscape;
                    var spaceTotalWidth      = screenHeight - cellTotalUsedWidth;
                    var spaceWidth           = spaceTotalWidth / (picker.ColsInLandscape - 1);
                    _landscapeLayout = new UICollectionViewFlowLayout {
                        MinimumInteritemSpacing = picker.MinimumInteritemSpacing,
                        ItemSize           = itemSize,
                        MinimumLineSpacing = (nfloat)spaceWidth
                    };

                    if (_landscapeLayout.RespondsToSelector(new ObjCRuntime.Selector("sectionInsetReference")))
                    {
                        _landscapeLayout.SectionInsetReference = UICollectionViewFlowLayoutSectionInsetReference.SafeArea;
                    }
                }
                return(_landscapeLayout);
            }
        }
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     //if(
 }
        //------------------------------------------------------------------------------------------------------------------------------------------------------------------
        public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
        {
            base.DidRotate(fromInterfaceOrientation);

            UpdateView();
        }
Пример #44
0
 public bool IsLandscape(UIInterfaceOrientation orientation)
 {
     return(orientation == UIInterfaceOrientation.LandscapeLeft || orientation == UIInterfaceOrientation.LandscapeRight);
 }
Пример #45
0
 public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
 {
     // Return true for supported orientations
     return(true);
 }
Пример #46
0
        void PositionHUD(NSNotification notification)
        {
            float  keyboardHeight    = 0;
            double animationDuration = 0;

            UIInterfaceOrientation orientation = UIApplication.SharedApplication.StatusBarOrientation;

            if (notification != null)
            {
                RectangleF keyboardFrame = UIKeyboard.FrameEndFromNotification(notification);
                animationDuration = UIKeyboard.AnimationDurationFromNotification(notification);

                if (notification.Name == UIKeyboard.WillShowNotification || notification.Name == UIKeyboard.DidShowNotification)
                {
                    if (IsPortrait(orientation))
                    {
                        keyboardHeight = keyboardFrame.Size.Height;
                    }
                    else
                    {
                        keyboardHeight = keyboardFrame.Size.Width;
                    }
                }
                else
                {
                    keyboardHeight = 0;
                }
            }
            else
            {
                keyboardHeight = VisibleKeyboardHeight;
            }

            RectangleF orientationFrame = UIScreen.MainScreen.Bounds;
            RectangleF statusBarFrame   = UIApplication.SharedApplication.StatusBarFrame;

            if (IsLandscape(orientation))
            {
                orientationFrame.Size = new SizeF(orientationFrame.Size.Height, orientationFrame.Size.Width);
                statusBarFrame.Size   = new SizeF(statusBarFrame.Size.Height, statusBarFrame.Size.Width);
            }

            float activeHeight = orientationFrame.Size.Height;

            if (keyboardHeight > 0)
            {
                activeHeight += statusBarFrame.Size.Height * 2;
            }

            activeHeight -= keyboardHeight;
            float posY = (float)Math.Floor(activeHeight * 0.45);
            float posX = orientationFrame.Size.Width / 2;

            if (!showToastCentered)
            {
                posY = activeHeight - 40;
            }

            PointF newCenter;
            float  rotateAngle;

            switch (orientation)
            {
            case UIInterfaceOrientation.PortraitUpsideDown:
                rotateAngle = (float)Math.PI;
                newCenter   = new PointF(posX, orientationFrame.Size.Height - posY);
                break;

            case UIInterfaceOrientation.LandscapeLeft:
                rotateAngle = (float)(-Math.PI / 2.0f);
                newCenter   = new PointF(posY, posX);
                break;

            case UIInterfaceOrientation.LandscapeRight:
                rotateAngle = (float)(Math.PI / 2.0f);
                newCenter   = new PointF(orientationFrame.Size.Height - posY, posX);
                break;

            default:                     // as UIInterfaceOrientationPortrait
                rotateAngle = 0.0f;
                newCenter   = new PointF(posX, posY);
                break;
            }

            if (notification != null)
            {
                UIView.Animate(animationDuration,
                               0, UIViewAnimationOptions.AllowUserInteraction, delegate {
                    MoveToPoint(newCenter, rotateAngle);
                }, null);
            }
            else
            {
                MoveToPoint(newCenter, rotateAngle);
            }
        }
Пример #47
0
 public override void WillAnimateRotation(UIInterfaceOrientation toInterfaceOrientation, double duration)
 {
     base.WillAnimateRotation(toInterfaceOrientation, duration);
 }
Пример #48
0
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     base.DidRotate(fromInterfaceOrientation);
     Web.Frame = View.Bounds;
 }
 public override void WillAnimateSecondHalfOfRotation(UIInterfaceOrientation fromInterfaceOrientation, double duration)
 {
     _masterViewController.WillAnimateSecondHalfOfRotation(fromInterfaceOrientation, duration);
     _detailViewController.WillAnimateSecondHalfOfRotation(fromInterfaceOrientation, duration);
 }
 public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
 {
     return(!UserInterfaceIdiomIsPhone || toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
 }
 public override void DidAnimateFirstHalfOfRotation(UIInterfaceOrientation toInterfaceOrientation)
 {
     _masterViewController.DidAnimateFirstHalfOfRotation(toInterfaceOrientation);
     _detailViewController.DidAnimateFirstHalfOfRotation(toInterfaceOrientation);
 }
Пример #52
0
 /// <summary>
 ///     Called after the view rotated
 ///     This override forwards the DidRotate callback on to each of the panel containers
 /// </summary>
 /// <param name="fromInterfaceOrientation">From interface orientation.</param>
 public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
 {
     base.DidRotate(fromInterfaceOrientation);
     _panelContainers.ForEach(c => c.DidRotate(fromInterfaceOrientation));
 }
 public override void WillAnimateFirstHalfOfRotation(UIInterfaceOrientation toInterfaceOrientation, double duration)
 {
     _masterViewController.WillAnimateFirstHalfOfRotation(toInterfaceOrientation, duration);
     _detailViewController.WillAnimateFirstHalfOfRotation(toInterfaceOrientation, duration);
 }
Пример #54
0
 /// <summary>
 ///     Called when the view will rotate.
 ///     This override forwards the WillRotate callback on to each of the panel containers
 /// </summary>
 /// <param name="toInterfaceOrientation">To interface orientation.</param>
 /// <param name="duration">Duration.</param>
 public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
 {
     base.WillRotate(toInterfaceOrientation, duration);
     _panelContainers.ForEach(c => c.WillRotate(toInterfaceOrientation, duration));
 }
Пример #55
0
 public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
 {
     // Return YES for supported orientations
     return(toInterfaceOrientation == UIInterfaceOrientation.Portrait);
 }
Пример #56
0
 public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
 {
     return(AppDelegate.IsPad);
 }
Пример #57
0
 public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
 {
     return(true);
 }
Пример #58
0
 public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
 {
     _ignoreNativeScrolling = true;
 }
 public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
 {
     // Return true for supported orientations
     return(toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
 }
 // [Obsolete]
 public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
 {
     // Return true for supported orientations
     return(true);            // (toInterfaceOrientation == UIInterfaceOrientation.LandscapeLeft || toInterfaceOrientation == UIInterfaceOrientation.LandscapeRight);
 }