本文整理汇总了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);
}
示例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);
}
}
}
示例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;
}
}
}
示例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);
}
}
}