Пример #1
0
 private void SwitchOrientation(UIInterfaceOrientation orientation, bool animated, double duration = 0.5)
 {
     if (orientation.IsLandscape() && false == _wasLandscape)
     {
         _animator.Rotate(orientation, animated, duration);
         _wasLandscape = true;
     }
     else if (orientation.IsPortrait() && _wasLandscape)
     {
         _animator.Rotate(orientation, animated, duration);
         _wasLandscape = false;
     }
 }
Пример #2
0
            private void TranslateLogo(UIInterfaceOrientation orientation, bool animate)
            {
                var offset = _isNudged ? -NudgeOffset : 0;

                if (orientation.IsLandscape())
                {
                    Translate(_controller.logo, 110, 300 + offset, animate);
                }
                else
                {
                    Translate(_controller.logo, 192, 252 + offset, animate);
                }
            }
Пример #3
0
            private void TranslateSignInForm(UIInterfaceOrientation orientation)
            {
                var offset = _isNudged ? -NudgeOffset : 0;

                if (orientation.IsLandscape())
                {
                    Translate(_controller.container, 556, 240 + offset);
                    BorderLeft(_controller.container);
                }
                else
                {
                    Translate(_controller.container, 222, 428 + offset);
                    BorderHorizontally(_controller.container);
                }
            }
Пример #4
0
        public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
        {
            if (imageView.Transform.IsIdentity)
            {
                SetImageViewConstraints(toInterfaceOrientation);
            }

            if (toInterfaceOrientation.IsLandscape() && !statusBarHidden)
            {
                UpdateBars();
            }
            else if (statusBarHidden)
            {
                UpdateBars();
            }
        }
Пример #5
0
        /// <summary>
        /// We override this to show/hide some controls during rotation
        /// </summary>c
        public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
        {
            bool wasPortrait     = InterfaceOrientation.IsPortrait();
            bool willBePortrait  = toInterfaceOrientation.IsPortrait();
            bool wasLandscape    = InterfaceOrientation.IsLandscape();
            bool willBeLandscape = toInterfaceOrientation.IsLandscape();

            if (wasPortrait && willBeLandscape)
            {
                SetContactVisible(true, duration);
            }
            else if (wasLandscape && willBePortrait)
            {
                SetContactVisible(false, duration);
            }

            base.WillRotate(toInterfaceOrientation, duration);
        }
Пример #6
0
 private void SwitchOrientation(UIInterfaceOrientation orientation)
 {
     if (orientation.IsLandscape())
     {
         if (!_wasLandscape)
         {
             NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[0], true);
             _wasLandscape = true;
         }
     }
     else
     {
         if (_wasLandscape)
         {
             NavigationItem.SetLeftBarButtonItems(new[] { _hideMenuButton }, true);
             _wasLandscape = false;
         }
     }
 }
 private void SwitchOrientation(UIInterfaceOrientation orientation, bool animated, double duration = .5)
 {
     if (orientation.IsLandscape())
     {
         if (!_wasLandscape)
         {
             _controller.NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[0], true);
             _wasLandscape = true;
         }
     }
     else
     {
         if (_wasLandscape)
         {
             _controller.NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { _showMenuButton }, true);
             _wasLandscape = false;
         }
     }
 }
Пример #8
0
        void SetImageViewConstraints(UIInterfaceOrientation orientation)
        {
            bool flip   = orientation.IsLandscape();
            var  bounds = UIScreen.MainScreen.Bounds;

            NSLayoutConstraint[] constraints = imageView.Constraints;

            foreach (var constraint in constraints)
            {
                if (constraint.FirstAttribute == NSLayoutAttribute.Height)
                {
                    constraint.Constant = flip ? bounds.Size.Width : bounds.Size.Height;
                }
                else if (constraint.FirstAttribute == NSLayoutAttribute.Width)
                {
                    constraint.Constant = flip ? bounds.Size.Height : bounds.Size.Width;
                }
            }
            imageView.SetNeedsUpdateConstraints();
        }
Пример #9
0
        /// <summary>
        /// Performs the work for animating the orientation
        /// </summary>
        private void SwitchOrientation(UIInterfaceOrientation orientation, bool animated, double duration = .5)
        {
            if (orientation.IsLandscape())
            {
                if (!wasLandscape)
                {
                    //Set the navbar to have only the back button
                    if (Theme.IsiOS7)
                    {
                        NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[0], true);
                    }
                    else
                    {
                        NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[0], true);
                    }

                    //Hide the master view if needed
                    if (masterPopoverShown)
                    {
                        AnimateMasterView(false);
                    }

                    if (animated)
                    {
                        UIView.BeginAnimations("SwitchOrientation");
                        UIView.SetAnimationDuration(duration);
                        UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
                    }

                    //Slide the masterView inward
                    var frame = masterView.Frame;
                    frame.X          = 0;
                    masterView.Frame = frame;

                    //Shrink the detailView
                    frame            = detailView.Frame;
                    frame.X         += masterWidth;
                    frame.Width     -= masterWidth;
                    detailView.Frame = frame;

                    if (animated)
                    {
                        UIView.CommitAnimations();
                    }
                    wasLandscape = true;
                }
            }
            else
            {
                if (wasLandscape)
                {
                    //Set the nav bar to include the menu button
                    if (Theme.IsiOS7)
                    {
                        NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] { menu }, true);
                    }
                    else
                    {
                        NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { menu }, true);
                    }

                    if (animated)
                    {
                        UIView.BeginAnimations("SwitchOrientation");
                        UIView.SetAnimationDuration(duration);
                        UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
                    }

                    //Slide the masterView off screen
                    var frame = masterView.Frame;
                    frame.X          = -frame.Width;
                    masterView.Frame = frame;

                    //Grow the detailView
                    frame            = detailView.Frame;
                    frame.X         -= masterWidth;
                    frame.Width     += masterWidth;
                    detailView.Frame = frame;

                    if (animated)
                    {
                        UIView.CommitAnimations();
                    }
                    wasLandscape = false;
                }
            }
        }
		/// <summary>
		/// We override this to show/hide some controls during rotation
		/// </summary>c
		public override void WillRotate (UIInterfaceOrientation toInterfaceOrientation, double duration)
		{
			bool wasPortrait = InterfaceOrientation.IsPortrait ();
			bool willBePortrait = toInterfaceOrientation.IsPortrait ();
			bool wasLandscape = InterfaceOrientation.IsLandscape ();
			bool willBeLandscape = toInterfaceOrientation.IsLandscape ();
			
			if (wasPortrait && willBeLandscape) {
				SetContactVisible (true, duration);
			} else if (wasLandscape && willBePortrait) {
				SetContactVisible (false, duration);
			}
			
			base.WillRotate (toInterfaceOrientation, duration);
		}
Пример #11
0
		/// <summary>
		/// Performs the work for animating the orientation
		/// </summary>
		private void SwitchOrientation(UIInterfaceOrientation orientation, bool animated, double duration = .5)
		{
			if (orientation.IsLandscape ())
			{
				if (!wasLandscape)
				{
					//Set the navbar to have only the back button
					if (Theme.IsiOS7) {
						NavigationItem.SetRightBarButtonItems (new UIBarButtonItem[0], true);
					} else {
						NavigationItem.SetLeftBarButtonItems (new UIBarButtonItem[0], true);
					}

					//Hide the master view if needed
					if (masterPopoverShown) {
						AnimateMasterView (false);
					}

					if (animated)
					{
						UIView.BeginAnimations ("SwitchOrientation");
						UIView.SetAnimationDuration (duration);
						UIView.SetAnimationCurve (UIViewAnimationCurve.EaseInOut);
					}

					//Slide the masterView inward
					var frame = masterView.Frame;
					frame.X = 0;
					masterView.Frame = frame;

					//Shrink the detailView
					frame = detailView.Frame;
					frame.X += masterWidth;
					frame.Width -= masterWidth;
					detailView.Frame = frame;

					if (animated)
					{
						UIView.CommitAnimations ();
					}
					wasLandscape = true;
				}
			}
			else
			{
				if (wasLandscape)
				{
					//Set the nav bar to include the menu button
					if (Theme.IsiOS7) {
						NavigationItem.SetRightBarButtonItems (new UIBarButtonItem[] { menu }, true);
					} else {
						NavigationItem.SetLeftBarButtonItems (new UIBarButtonItem[] { menu }, true);
					}

					if (animated)
					{
						UIView.BeginAnimations ("SwitchOrientation");
						UIView.SetAnimationDuration (duration);
						UIView.SetAnimationCurve (UIViewAnimationCurve.EaseInOut);
					}

					//Slide the masterView off screen
					var frame = masterView.Frame;
					frame.X = -frame.Width;
					masterView.Frame = frame;

					//Grow the detailView
					frame = detailView.Frame;
					frame.X -= masterWidth;
					frame.Width += masterWidth;
					detailView.Frame = frame;

					if (animated)
					{
						UIView.CommitAnimations ();
					}
					wasLandscape = false;
				}
			}
		}
Пример #12
0
 public SizeF GridViewSizeInFullSizeForCell(GridView gridView, GridViewCell cell, int index, UIInterfaceOrientation orientation)
 {
     if (GridViewConstants.IsIphone)
     {
         if (orientation.IsLandscape())
         {
             return new SizeF(320, 210);
         }
         else
         {
             return new SizeF(300, 310);
         }
     }
     else
     {
         if (orientation.IsLandscape())
         {
             return new SizeF(700, 530);
         }
         else
         {
             return new SizeF(600, 500);
         }
     }
 }
Пример #13
0
 public SizeF GridViewSizeForItemsInInterfaceOrientation(GridView gridView, UIInterfaceOrientation orientation)
 {
     if (GridViewConstants.IsIphone)
     {
         if (orientation.IsLandscape())
         {
             return new SizeF(170, 135);
         }
         else
         {
             return new SizeF(140, 110);
         }
     }
     else
     {
         if (orientation.IsLandscape())
         {
             return new SizeF(285, 205);
         }
         else
         {
             return new SizeF(230, 175);
         }
     }
 }
Пример #14
0
        private void SwitchOrientation(UIInterfaceOrientation orientation, bool animated, double duration = .5)
        {
            if (orientation.IsLandscape())
            {
                if (_wasLandscape)
                {
                    return;
                }

                if (_isMasterPopoverShown)
                {
                    AnimateMasterView(false);
                }

                if (animated)
                {
                    UIView.BeginAnimations("SwitchOrientation");
                    UIView.SetAnimationDuration(duration);
                    UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
                }

                //Slide the masterView inward
                var frame = masterView.Frame;
                frame.X          = 0;
                masterView.Frame = frame;

                //Shrink the detailView
                frame            = detailView.Frame;
                frame.X         += MasterWidth;
                frame.Width     -= MasterWidth;
                detailView.Frame = frame;

                if (animated)
                {
                    UIView.CommitAnimations();
                }
                _wasLandscape = true;
            }
            else
            {
                if (!_wasLandscape)
                {
                    return;
                }

                if (animated)
                {
                    UIView.BeginAnimations("SwitchOrientation");
                    UIView.SetAnimationDuration(duration);
                    UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
                }

                //Slide the masterView off screen
                var frame = masterView.Frame;
                frame.X          = -frame.Width;
                masterView.Frame = frame;

                //Grow the detailView
                frame            = detailView.Frame;
                frame.X         -= MasterWidth;
                frame.Width     += MasterWidth;
                detailView.Frame = frame;

                if (animated)
                {
                    UIView.CommitAnimations();
                }
                _wasLandscape = false;
            }
        }