public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            /*
             * We override viewWillTransition(to size: with coordinator:) in order to add special behavior
             * when the app changes size, especially when the device is rotated.
             * In this demo app, we add an effect to make the items "pop" towards the viewer during the rotation,
             * and then go back to normal afterwards.
             */

            base.ViewWillTransitionToSize(toSize, coordinator);

            // If self.stackView is null, then our view has not yet been loaded, and there is nothing to do.
            if (this.stackView != null)
            {
                // Add alongside and completion animations.
                coordinator.AnimateAlongsideTransition((_) =>
                {
                    /*
                     * Scale the stackView to be larger than normal.
                     * This animates along with the rest of the rotation animation.
                     */
                    this.stackView.Transform = CGAffineTransform.MakeScale(1.4f, 1.4f);
                }, (_) =>
                {
                    /*
                     * The rotation animation is complete. Add an additional 0.5 second
                     * animation to set the scale back to normal.
                     */
                    UIView.Animate(0.5f, () => this.stackView.Transform = CGAffineTransform.MakeIdentity());
                });
            }
        }
Example #2
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            MainContainerView.Transform = CGAffineTransform.MakeScale(1.0f, 1.0f);
            LeftContainerView.Hidden    = true;
            RightContainerView.Hidden   = true;

            coordinator.AnimateAlongsideTransition((obj) => { }, (IUIViewControllerTransitionCoordinatorContext obj) =>
            {
                CloseLeftNonAnimation();
                CloseRightNonAnimation();
                LeftContainerView.Hidden  = false;
                RightContainerView.Hidden = false;

                if (LeftPanGesture != null && LeftTapGesture != null)
                {
                    RemoveLeftGestures();
                    AddLeftGestures();
                }

                if (RightPanGesture != null && RightTapGesture != null)
                {
                    RemoveRightGestures();
                    AddRightGestures();
                }
            });
        }
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            var updatedVisibleCellCount = this.NumberOfTableRowsToDisplay();
            var currentVisibleCellCount = base.TableView.VisibleCells.Length;
            var cellCountDifference     = updatedVisibleCellCount - currentVisibleCellCount;

            // If the number of visible cells has changed, animate them in/out along with the resize animation.
            if (cellCountDifference != 0)
            {
                coordinator.AnimateAlongsideTransition((_) =>
                {
                    base.TableView.PerformBatchUpdates(() =>
                    {
                        var indexPaths = new List <NSIndexPath>();
                        // Build an array of IndexPath objects representing the rows to be inserted or deleted.
                        for (int i = 1; i <= Math.Abs(cellCountDifference); i++)
                        {
                            indexPaths.Add(NSIndexPath.FromRowSection(i, 0));
                        }

                        // Animate the insertion or deletion of the rows.
                        if (cellCountDifference > 0)
                        {
                            base.TableView.InsertRows(indexPaths.ToArray(), UITableViewRowAnimation.Fade);
                        }
                        else
                        {
                            base.TableView.DeleteRows(indexPaths.ToArray(), UITableViewRowAnimation.Fade);
                        }
                    }, null);
                }, null);
            }
        }
Example #4
0
        public override void WillTransitionToTraitCollection(UITraitCollection traitCollection,
                                                             IUIViewControllerTransitionCoordinator coordinator)
        {
            if (TitleScrollView != null)
            {
                TitleScrollView.Delegate = null;
            }
            if (ContentScrollView != null)
            {
                ContentScrollView.Delegate = null;
            }

            coordinator?.AnimateAlongsideTransition(context => { }, context =>
            {
                if (TitleScrollView != null)
                {
                    TitleScrollView.Delegate = this;
                }
                if (ContentScrollView != null)
                {
                    ContentScrollView.Delegate = this;
                }
                SwitchPage(_selectedIndex, false);
            });
        }
Example #5
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            var videoPreviewLayerConnection = this.PreviewView.VideoPreviewLayer.Connection;

            if (videoPreviewLayerConnection != null)
            {
                var deviceOrientation = UIDevice.CurrentDevice.Orientation;
                if (deviceOrientation.IsPortrait() || deviceOrientation.IsLandscape())
                {
                    var newVideoOrientation = this.ConvertOrientation(deviceOrientation);
                    videoPreviewLayerConnection.VideoOrientation = newVideoOrientation;

                    // When we transition to the new size, we need to adjust the region
                    // of interest's origin and size so that it stays anchored relative
                    // to the camera.
                    coordinator.AnimateAlongsideTransition((context) => // animate
                    {
                        var newRegionOfInterest = this.PreviewView.VideoPreviewLayer.MapToLayerCoordinates(this.metadataOutput.RectOfInterest);
                        this.PreviewView.SetRegionOfInterestWithProposedRegionOfInterest(newRegionOfInterest);
                    }, (context) => // completion
                    {
                        // Remove the old metadata object overlays
                        this.RemoveMetadataObjectOverlayLayers();
                    });
                }
            }
        }
Example #6
0
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.ViewWillTransitionToSize(toSize, coordinator);
     coordinator.AnimateAlongsideTransition(
         (context) => { ButtonCollectionView.ReloadData(); },
         completion: null
         );
 }
Example #7
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            coordinator.AnimateAlongsideTransition(
                _ => PresentedView.Frame = new CGRect(ContainerView.Frame.X, toSize.Height - PresentedView.Frame.Height, toSize.Width, PresentedView.Frame.Height),
                null);
        }
Example #8
0
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     coordinator.AnimateAlongsideTransition(context =>
     {
         SuggestionsContainerView.Layer.Opacity = currentDisplayMode == NCWidgetDisplayMode.Compact ? 0 : 1;
     }, null);
     base.ViewWillTransitionToSize(toSize, coordinator);
 }
Example #9
0
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.ViewWillTransitionToSize(toSize, coordinator);
     coordinator.AnimateAlongsideTransition((obj) => { }, (obj) =>
     {
         IOSGameWindow.Instance.OnResize(toSize);
     });
 }
Example #10
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);
            CATransaction.Begin();
            CATransaction.DisableActions = true;

            coordinator.AnimateAlongsideTransition(ctx => { }, ctx => CATransaction.Commit());
        }
Example #11
0
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.ViewWillTransitionToSize(toSize, coordinator);
     coordinator.AnimateAlongsideTransition((obj) => {
         UIInterfaceOrientation orientation = UIApplication.SharedApplication.StatusBarOrientation;
         ApplyCameraGlOrientation(orientation);
     }, null);
 }
Example #12
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            coordinator.AnimateAlongsideTransition(_ => { }, _ => UIView.AnimationsEnabled = true);
            UIView.AnimationsEnabled = false;
            base.ViewWillTransitionToSize(toSize, coordinator);

            (View as IOSGameView)?.RequestResizeFrameBuffer();
        }
Example #13
0
 public override void WillTransitionToTraitCollection(UITraitCollection traitCollection, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.WillTransitionToTraitCollection(traitCollection, coordinator);
     coordinator.AnimateAlongsideTransition((UIViewControllerTransitionCoordinatorContext) => {
         UpdateConstraintsForTraitCollection(traitCollection);
         View.SetNeedsLayout();
     }, (UIViewControllerTransitionCoordinatorContext) => {
     });
 }
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.ViewWillTransitionToSize(toSize, coordinator);
     coordinator.AnimateAlongsideTransition((param) => { }, (context) =>
     {
         // Disable zooming if our pages are currently shown in landscape after orientation changes
         ScrollView.UserInteractionEnabled = UIApplication.SharedApplication.StatusBarOrientation.IsPortrait();
     });
 }
Example #15
0
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     coordinator.AnimateAlongsideTransition((obj) =>
     {
         CollectionView?.SetCollectionViewLayout(CreateCollectionViewLayout(), true);
         CollectionView?.ReloadData();
     },
                                            (obj) => { });
 }
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            coordinator.AnimateAlongsideTransition((IUIViewControllerTransitionCoordinatorContext obj) =>
            {
                CollectionView.ReloadData();
            }, (IUIViewControllerTransitionCoordinatorContext obj) => { });

            base.ViewWillTransitionToSize(toSize, coordinator);
        }
Example #17
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);
            //update capture session with new interface orientation

            _captureSession.UpdateVideoOrientation(
                GetCaptureVideoOrientation(UIApplication.SharedApplication.StatusBarOrientation));

            coordinator.AnimateAlongsideTransition(context => { UpdateContentInset(); },
                                                   context => { UpdateItemSize(); });
        }
Example #18
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            coordinator.AnimateAlongsideTransition((obj) => {}, (obj) => {
                float width             = (float)toSize.Width;
                ContentView.ContentSize = new SizeF(width, 60f + (float)(width * 0.56) + 72f);
            });

            View.LayoutIfNeeded();
        }
Example #19
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            coordinator.AnimateAlongsideTransition((obj) =>
            {
                var orientation = UIApplication.SharedApplication.StatusBarOrientation;
                var isLandscape = orientation == UIInterfaceOrientation.LandscapeLeft || orientation == UIInterfaceOrientation.LandscapeRight;
                SetBackgroundImage(isLandscape);
            }, null);
        }
        public void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            //initial call to move menu off screen to hide it while transitioning
            double bigValue = UIScreen.MainScreen.Bounds.Height > UIScreen.MainScreen.Bounds.Width ? UIScreen.MainScreen.Bounds.Height : UIScreen.MainScreen.Bounds.Width;

            ScreenSizeHelper.ScreenWidth = ScreenSizeHelper.ScreenHeight = bigValue;
            UpdateMenuLayout();

            //handle resizing after transition is complete
            coordinator.AnimateAlongsideTransition((obj) => {}, (obj) => OnViewWillTransitionToSize(toSize));
        }
Example #21
0
        public override void ViewWillTransitionToSize(CoreGraphics.CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);


            coordinator.AnimateAlongsideTransition(null, (context) =>
            {
                //should be called after rotation animation completed
                this.contextMenuTableView.ReloadData();
            });
            this.contextMenuTableView.UpdateAlongsideRotation();
        }
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);
            var indexPath = CurrentIndexPath;

            View.Hidden = true;
            coordinator.AnimateAlongsideTransition(null, (_) =>
            {
                this.View.InvalidateIntrinsicContentSize();
                this.CollectionView?.ReloadData();
                this.ScrollCollectionView(indexPath);
                this.View.Hidden = false;
            });
        }
Example #23
0
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     coordinator.AnimateAlongsideTransition((context) =>
     {
         var orientation  = UIApplication.SharedApplication.StatusBarOrientation;
         var y            = toSize.Height - bannerSize.Height;
         var width        = toSize.Width;
         bannerView.Frame = new CGRect((width - bannerSize.Width) / 2.0, y, bannerSize.Width, bannerSize.Height);
     },
                                            (context) =>
     {
     });
     base.ViewWillTransitionToSize(toSize, coordinator);
 }
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            presentationWrappingView.ClipsToBounds       = true;
            presentationWrappingView.Layer.ShadowOpacity = .0f;
            presentationWrappingView.Layer.ShadowRadius  = .0f;

            coordinator.AnimateAlongsideTransition((obj) => {}, (obj) => {
                presentationWrappingView.ClipsToBounds       = false;
                presentationWrappingView.Layer.ShadowOpacity = .63f;
                presentationWrappingView.Layer.ShadowRadius  = 17f;
            });
        }
		public override void ViewWillTransitionToSize (CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
		{
			base.ViewWillTransitionToSize (toSize, coordinator);

			var corner = stickyBehavior.CurrentCorner;
			stickyBehavior.Enabled = false;
			stickyBehavior.UpdateFieldsInBounds (new CGRect (CGPoint.Empty, toSize));

			coordinator.AnimateAlongsideTransition (context => {
				itemView.Center = stickyBehavior.GetPositionForCorner (corner);
			}, context => {
				stickyBehavior.Enabled = true;
			});
		}
Example #26
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            var corner = stickyBehavior.CurrentCorner;

            stickyBehavior.Enabled = false;
            stickyBehavior.UpdateFieldsInBounds(new CGRect(CGPoint.Empty, toSize));

            coordinator.AnimateAlongsideTransition(context => {
                itemView.Center = stickyBehavior.GetPositionForCorner(corner);
            }, context => {
                stickyBehavior.Enabled = true;
            });
        }
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            coordinator.AnimateAlongsideTransition((obj) =>
            {
                var orientation = UIDevice.CurrentDevice.Orientation;
                if (mAnnotationToolbar != null)
                {
                    mAnnotationToolbar.RotateToOrientation(orientation);
                }
            }, (obj) =>
            {
            });
        }
Example #28
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);
            isViewRotating   = true;
            pageBeforeRotate = CurrentIndex;

            coordinator.AnimateAlongsideTransition((context) =>
            {
                if (this != null)
                {
                    isViewRotating = false;
                    CurrentIndex   = pageBeforeRotate;
                    UpdateIfNeeded();
                }
            }, (context) => { });
        }
Example #29
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            if (coordinator != null)
            {
                coordinator.AnimateAlongsideTransition((IUIViewControllerTransitionCoordinatorContext context) =>
                {
                    UIInterfaceOrientation newInterfaceOrientation = UIApplication.SharedApplication.StatusBarOrientation;
                    architectView.SetShouldRotateToInterfaceOrientation(true, newInterfaceOrientation);
                }, null);
            }
            else
            {
                UIInterfaceOrientation newInterfaceOrientation = UIApplication.SharedApplication.StatusBarOrientation;
                architectView.SetShouldRotateToInterfaceOrientation(true, newInterfaceOrientation);
            }

            base.ViewWillTransitionToSize(toSize, coordinator);
        }
Example #30
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            // don't bother resizing if the view isn't visible
            if (View.Hidden)
            {
                return;
            }

            if (SideMenuManager.SideMenuTransition.StatusBarView != null)
            {
                SideMenuManager.SideMenuTransition.StatusBarView.Hidden = true;
                coordinator.AnimateAlongsideTransition(
                    (_) => SideMenuManager.SideMenuTransition.PresentMenuStart(toSize),
                    (_) => SideMenuManager.SideMenuTransition.StatusBarView.Hidden = false);
            }
        }
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     //base.ViewWillTransitionToSize(toSize, coordinator);
     if (toSize.Width != View.Frame.Size.Width)
     {
         if (mapView.AutoRotateEnabled)
         {
             mapView.SetAutoRotateEnabled(false, false);
             coordinator.AnimateAlongsideTransition
             (
                 (context) =>
             {
                 mapView.SetAutoRotateEnabled(true, true);
             },
                 null
             );
         }
     }
 }
		public override void ViewWillTransitionToSize (CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
		{
			base.ViewWillTransitionToSize (toSize, coordinator);

			var videoPreviewLayerConnection = PreviewView.VideoPreviewLayer.Connection;
			if (videoPreviewLayerConnection != null) {
				var deviceOrientation = UIDevice.CurrentDevice.Orientation;
				if (!deviceOrientation.IsPortrait () && !deviceOrientation.IsLandscape ())
					return;

				var newVideoOrientation = VideoOrientationFor (deviceOrientation);
				var oldSize = View.Frame.Size;
				var oldVideoOrientation = videoPreviewLayerConnection.VideoOrientation;
				videoPreviewLayerConnection.VideoOrientation = newVideoOrientation;

				// When we transition to the new size, we need to adjust the region
				// of interest's origin and size so that it stays anchored relative
				// to the camera.
				coordinator.AnimateAlongsideTransition (context => {
					var oldRegion = PreviewView.RegionOfInterest;
					var newRegion = new CGRect ();

					if (oldVideoOrientation == LandscapeRight && newVideoOrientation == LandscapeLeft) {
						newRegion = oldRegion.WithX (oldSize.Width - oldRegion.X - oldRegion.Width);
					} else if (oldVideoOrientation == LandscapeRight && newVideoOrientation == Portrait) {
						newRegion.X = toSize.Width - oldRegion.Y - oldRegion.Height;
						newRegion.Y = oldRegion.X;
						newRegion.Width = oldRegion.Height;
						newRegion.Height = oldRegion.Width;
					} else if (oldVideoOrientation == LandscapeLeft && newVideoOrientation == LandscapeRight) {
						newRegion = oldRegion.WithX (oldSize.Width - oldRegion.X - oldRegion.Width);
					} else if (oldVideoOrientation == LandscapeLeft && newVideoOrientation == Portrait) {
						newRegion.X = oldRegion.Y;
						newRegion.Y = oldSize.Width - oldRegion.X - oldRegion.Width;
						newRegion.Width = oldRegion.Height;
						newRegion.Height = oldRegion.Width;
					} else if (oldVideoOrientation == Portrait && newVideoOrientation == LandscapeRight) {
						newRegion.X = oldRegion.Y;
						newRegion.Y = toSize.Height - oldRegion.X - oldRegion.Width;
						newRegion.Width = oldRegion.Height;
						newRegion.Height = oldRegion.Width;
					} else if (oldVideoOrientation == Portrait && newVideoOrientation == LandscapeLeft) {
						newRegion.X = oldSize.Height - oldRegion.Y - oldRegion.Height;
						newRegion.Y = oldRegion.X;
						newRegion.Width = oldRegion.Height;
						newRegion.Height = oldRegion.Width;
					}

					PreviewView.SetRegionOfInterestWithProposedRegionOfInterest (newRegion);
				}, context => {
					sessionQueue.DispatchAsync (() => {
						metadataOutput.RectOfInterest = PreviewView.VideoPreviewLayer.MapToLayerCoordinates (PreviewView.RegionOfInterest);
					});
					// Remove the old metadata object overlays.
					RemoveMetadataObjectOverlayLayers ();
				});
			}
		}
		public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
			CGSize oldSize = View.Bounds.Size;

            if (oldSize != toSize)
            {
                UIInterfaceOrientation prevOrientation = InterfaceOrientation;

                // In iOS 8+ DidRotate is no longer called after a rotation
                // But we need to notify iOSGamePlatform to update back buffer so we explicitly call it 

                // We do this within the animateAlongside action, which at the point of calling
                // will have the new InterfaceOrientation set
                coordinator.AnimateAlongsideTransition((context) =>
                    {
                        DidRotate(prevOrientation);
                    }, (context) => 
                    {
                    });

            }

            base.ViewWillTransitionToSize(toSize, coordinator);
        }
		public override void WillTransitionToTraitCollection (UITraitCollection traitCollection, IUIViewControllerTransitionCoordinator coordinator)
		{
			base.WillTransitionToTraitCollection (traitCollection, coordinator);
			coordinator.AnimateAlongsideTransition ((UIViewControllerTransitionCoordinatorContext) => {
				UpdateConstraintsForTraitCollection (traitCollection);
				View.SetNeedsLayout ();
			}, (UIViewControllerTransitionCoordinatorContext) => {
			});
		}