当前位置: 首页>>代码示例>>C#>>正文


C# UIInterfaceOrientation.IsLandscape方法代码示例

本文整理汇总了C#中UIInterfaceOrientation.IsLandscape方法的典型用法代码示例。如果您正苦于以下问题:C# UIInterfaceOrientation.IsLandscape方法的具体用法?C# UIInterfaceOrientation.IsLandscape怎么用?C# UIInterfaceOrientation.IsLandscape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIInterfaceOrientation的用法示例。


在下文中一共展示了UIInterfaceOrientation.IsLandscape方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WillRotate

		/// <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);
		}
开发者ID:felipecembranelli,项目名称:MyXamarinSamples,代码行数:18,代码来源:MainMapController.cs

示例2: GridViewSizeInFullSizeForCell

 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);
         }
     }
 }
开发者ID:skela,项目名称:GMGridView,代码行数:25,代码来源:DemoViewController.cs

示例3: SwitchOrientation

		/// <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;
				}
			}
		}
开发者ID:EminosoftCorp,项目名称:prebuilt-apps,代码行数:83,代码来源:SplitController.cs

示例4: GridViewSizeForItemsInInterfaceOrientation

 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);
         }
     }
 }
开发者ID:skela,项目名称:GMGridView,代码行数:25,代码来源:DemoViewController.cs


注:本文中的UIInterfaceOrientation.IsLandscape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。