/// <summary> /// Gets the should rotate6. /// </summary> /// <param name="orientation">The orientation.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> private bool GetShouldRotate6(UIDeviceOrientation orientation) { if (!_viewController.ShouldAutorotate()) { return(false); } var mask = UIInterfaceOrientationMask.Portrait; switch (orientation) { case UIDeviceOrientation.LandscapeLeft: mask = UIInterfaceOrientationMask.LandscapeLeft; break; case UIDeviceOrientation.LandscapeRight: mask = UIInterfaceOrientationMask.LandscapeRight; break; case UIDeviceOrientation.Portrait: mask = UIInterfaceOrientationMask.Portrait; break; case UIDeviceOrientation.PortraitUpsideDown: mask = UIInterfaceOrientationMask.PortraitUpsideDown; break; default: return(false); } return(_viewController.GetSupportedInterfaceOrientations().HasFlag(mask)); }
protected override void UpdateUI() { base.UpdateUI(); if (this.deviceType == UIDeviceType.Phone) { switch (this.deviceOrientation) { case UIDeviceOrientation.Portrait: case UIDeviceOrientation.PortraitUpsideDown: this.ApplyRect(this.phonePortrait); break; case UIDeviceOrientation.LandscapeRight: case UIDeviceOrientation.LandscapeLeft: this.ApplyRect(this.phoneLandscape); break; } } else { UIDeviceOrientation deviceOrientation = this.deviceOrientation; if (deviceOrientation != UIDeviceOrientation.Portrait) { if (deviceOrientation == UIDeviceOrientation.LandscapeRight || deviceOrientation == UIDeviceOrientation.LandscapeLeft) { this.ApplyRect(this.tabletLandscape); } } else { this.ApplyRect(this.tabletPortrait); } } }
private UIDeviceOrientation CovertDeviceOrientation(DeviceOrientation newOrientation) { UIDeviceOrientation result = UIDeviceOrientation.Portrait; switch (newOrientation) { case DeviceOrientation.Portrait: case DeviceOrientation.FaceUp: result = UIDeviceOrientation.Portrait; break; case DeviceOrientation.PortraitUpsideDown: case DeviceOrientation.FaceDown: result = UIDeviceOrientation.PortraitUpsideDown; break; case DeviceOrientation.LandscapeLeft: result = UIDeviceOrientation.LandscapeLeft; break; case DeviceOrientation.LandscapeRight: result = UIDeviceOrientation.LandscapeRight; break; } return(result); }
public void DidReceiveRemoteVideoTrack(IARDAppClient client, RTCVideoTrack remoteVideoTrack) { this.remoteVideoTrack = remoteVideoTrack; this.remoteVideoTrack.AddRenderer(remoteView); UIView.Animate(0.4f, () => { // //Instead of using 0.4 of screen size, we re-calculate the local view and keep our aspect ratio UIDeviceOrientation orientation = UIDevice.CurrentDevice.Orientation; var containerWidth = View.Frame.Size.Width; var containerHeight = View.Frame.Size.Height; var videoRect = new CGRect(0.0f, 0.0f, containerWidth / 4.0f, containerHeight / 4.0f); if (orientation == UIDeviceOrientation.LandscapeLeft || orientation == UIDeviceOrientation.LandscapeRight) { videoRect = new CGRect(0.0f, 0.0f, containerHeight / 4.0f, containerWidth / 4.0f); } CGRect videoFrame = AVFoundation.AVUtilities.WithAspectRatio(videoRect, localView.Frame.Size); //AVMakeRectWithAspectRatioInsideRect(aspectRatio, videoRect); // [self.localViewWidthConstraint setConstant:videoFrame.size.width]; // [self.localViewHeightConstraint setConstant:videoFrame.size.height]; // [self.localViewBottomConstraint setConstant:28.0f]; // [self.localViewRightConstraint setConstant:28.0f]; // [self.footerViewBottomConstraint setConstant:-80.0f]; View.LayoutIfNeeded(); });; }
/// <summary> /// Convert device orientation to image orientation for use by Vision analysis. /// </summary> public static CGImagePropertyOrientation ConvertFrom(UIDeviceOrientation deviceOrientation) { CGImagePropertyOrientation result; switch (deviceOrientation) { case UIDeviceOrientation.PortraitUpsideDown: result = CGImagePropertyOrientation.Left; break; case UIDeviceOrientation.LandscapeLeft: result = CGImagePropertyOrientation.Up; break; case UIDeviceOrientation.LandscapeRight: result = CGImagePropertyOrientation.Down; break; default: result = CGImagePropertyOrientation.Right; break; } return(result); }
protected override void UpdateUI() { base.UpdateUI(); if (this.deviceType == UIDeviceType.Phone) { UIDeviceOrientation deviceOrientation = this.deviceOrientation; if (deviceOrientation != UIDeviceOrientation.Portrait) { if (deviceOrientation == UIDeviceOrientation.LandscapeRight || deviceOrientation == UIDeviceOrientation.LandscapeLeft) { this.ApplyFont(this.phoneLandscape); } } else { this.ApplyFont(this.phonePortrait); } } else { UIDeviceOrientation deviceOrientation2 = this.deviceOrientation; if (deviceOrientation2 != UIDeviceOrientation.Portrait) { if (deviceOrientation2 == UIDeviceOrientation.LandscapeRight || deviceOrientation2 == UIDeviceOrientation.LandscapeLeft) { this.ApplyFont(this.tabletLandscape); } } else { this.ApplyFont(this.tabletPortrait); } } }
private AVCaptureVideoOrientation orientationFromDeviceOrientation(UIDeviceOrientation orientation) { AVCaptureVideoOrientation retOrientation; switch (orientation) { case UIDeviceOrientation.PortraitUpsideDown: retOrientation = AVCaptureVideoOrientation.PortraitUpsideDown; break; case UIDeviceOrientation.Portrait: retOrientation = AVCaptureVideoOrientation.Portrait; break; case UIDeviceOrientation.LandscapeLeft: retOrientation = AVCaptureVideoOrientation.LandscapeLeft; break; case UIDeviceOrientation.LandscapeRight: retOrientation = AVCaptureVideoOrientation.LandscapeRight; break; default: retOrientation = (AVCaptureVideoOrientation)0; break; } return(retOrientation); }
CGImagePropertyOrientation ExifOrientationFromDeviceOrientation() { UIDeviceOrientation curDeviceOrientation = UIDevice.CurrentDevice.Orientation; CGImagePropertyOrientation exifOrientation; switch (curDeviceOrientation) { case UIDeviceOrientation.PortraitUpsideDown: exifOrientation = CGImagePropertyOrientation.Left; break; case UIDeviceOrientation.LandscapeLeft: exifOrientation = CGImagePropertyOrientation.UpMirrored; break; case UIDeviceOrientation.LandscapeRight: exifOrientation = CGImagePropertyOrientation.Down; break; case UIDeviceOrientation.Portrait: exifOrientation = CGImagePropertyOrientation.Up; break; default: exifOrientation = CGImagePropertyOrientation.Left; break; } return(exifOrientation); }
private static SimpleOrientation ToSimpleOrientation(UIDeviceOrientation deviceOrientation) { switch (deviceOrientation) { case UIDeviceOrientation.Portrait: return(SimpleOrientation.NotRotated); case UIDeviceOrientation.PortraitUpsideDown: return(SimpleOrientation.Rotated180DegreesCounterclockwise); case UIDeviceOrientation.LandscapeLeft: return(SimpleOrientation.Rotated90DegreesCounterclockwise); case UIDeviceOrientation.LandscapeRight: return(SimpleOrientation.Rotated270DegreesCounterclockwise); case UIDeviceOrientation.FaceUp: return(SimpleOrientation.Faceup); case UIDeviceOrientation.FaceDown: return(SimpleOrientation.Facedown); case UIDeviceOrientation.Unknown: default: return(SimpleOrientation.NotRotated); } }
/// <summary> /// Gets the should rotate. /// </summary> /// <param name="orientation">The orientation.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> private bool GetShouldRotate(UIDeviceOrientation orientation) { var iorientation = UIInterfaceOrientation.Portrait; switch (orientation) { case UIDeviceOrientation.LandscapeLeft: iorientation = UIInterfaceOrientation.LandscapeLeft; break; case UIDeviceOrientation.LandscapeRight: iorientation = UIInterfaceOrientation.LandscapeRight; break; case UIDeviceOrientation.Portrait: iorientation = UIInterfaceOrientation.Portrait; break; case UIDeviceOrientation.PortraitUpsideDown: iorientation = UIInterfaceOrientation.PortraitUpsideDown; break; default: return(false); } return(_viewController.ShouldAutorotateToInterfaceOrientation(iorientation)); }
public void SetOrientation(UIDeviceOrientation orientation) { var activity = (Activity)Xamarin.Forms.Forms.Context; if (activity == null) { return; } switch (orientation) { case UIDeviceOrientation.Landscape: activity.RequestedOrientation = ScreenOrientation.Landscape; break; case UIDeviceOrientation.ReverseLandscape: activity.RequestedOrientation = ScreenOrientation.ReverseLandscape; break; case UIDeviceOrientation.Portrait: activity.RequestedOrientation = ScreenOrientation.Portrait; break; case UIDeviceOrientation.ReversePortrait: activity.RequestedOrientation = ScreenOrientation.ReversePortrait; break; } }
private AVCaptureVideoOrientation ConvertOrientation(UIDeviceOrientation deviceOrientation) { var result = default(AVCaptureVideoOrientation); switch (deviceOrientation) { case UIDeviceOrientation.Portrait: result = AVCaptureVideoOrientation.Portrait; break; case UIDeviceOrientation.PortraitUpsideDown: result = AVCaptureVideoOrientation.PortraitUpsideDown; break; // TODO: change to logical naming after it will be fixed (map `LandscapeLeft` to `LandscapeLeft`) case UIDeviceOrientation.LandscapeLeft: result = AVCaptureVideoOrientation.LandscapeRight; break; case UIDeviceOrientation.LandscapeRight: result = AVCaptureVideoOrientation.LandscapeLeft; break; default: throw new InvalidProgramException(); } return(result); }
static bool TryConvertToVideoOrientation(UIDeviceOrientation orientation, out AVCaptureVideoOrientation result) { switch (orientation) { case UIDeviceOrientation.Portrait: result = AVCaptureVideoOrientation.Portrait; return(true); case UIDeviceOrientation.PortraitUpsideDown: result = AVCaptureVideoOrientation.PortraitUpsideDown; return(true); case UIDeviceOrientation.LandscapeLeft: result = AVCaptureVideoOrientation.LandscapeRight; return(true); case UIDeviceOrientation.LandscapeRight: result = AVCaptureVideoOrientation.LandscapeLeft; return(true); default: result = 0; return(false); } }
private void OnSystemOrientationChanged(DeviceOrientation newOrientation) { if (!this.SupportOrientationChange) { return; } UIDeviceOrientation uideviceOrientation = this.CovertDeviceOrientation(newOrientation); if ((uideviceOrientation & this.supportedOrientations) == (UIDeviceOrientation)0) { return; } switch (uideviceOrientation) { case UIDeviceOrientation.Portrait: Screen.orientation = ScreenOrientation.Portrait; break; case UIDeviceOrientation.PortraitUpsideDown: Screen.orientation = ScreenOrientation.PortraitUpsideDown; break; case UIDeviceOrientation.LandscapeRight: Screen.orientation = ScreenOrientation.LandscapeRight; break; case UIDeviceOrientation.LandscapeLeft: Screen.orientation = ScreenOrientation.LandscapeRight; break; } UILayoutManager.Orientation = uideviceOrientation; this.SendOrientation(); }
protected override Task <bool> OnPushAsync(Page page, bool animated) { CheckShadow(page, true); this.currentOrientation = UIDevice.CurrentDevice.Orientation; this.pushedPage = true; return(base.OnPushAsync(page, animated)); }
private void CapturePhoto(object sender, EventArgs e) { ToogleButtons(false); var settingKeys = new object[] { AVVideo.CodecKey, AVVideo.CompressionPropertiesKey, }; var settingObjects = new object[] { new NSString("jpeg"), new NSDictionary(AVVideo.QualityKey, 1), }; var settingsDictionary = NSDictionary <NSString, NSObject> .FromObjectsAndKeys(settingObjects, settingKeys); var settings = AVCapturePhotoSettings.FromFormat(settingsDictionary); if (_capturePhotoOutput.SupportedFlashModes.Length > 0 && _captureDeviceInput.Device.Position == AVCaptureDevicePosition.Back) { settings.FlashMode = _flashMode; } orientationOnPhoto = currentOrientation; _capturePhotoOutput.CapturePhoto(settings, this); }
/// <summary> /// Gets the value whether the current view should be rotated. /// </summary> /// <param name="deviceOrientation">The new orientation.</param> /// <returns><c>true</c> if the view should be rotated; <c>false</c> otherwise.</returns> private bool GetShouldRotate(UIDeviceOrientation deviceOrientation) { // Get the new orientation UIInterfaceOrientation newOrientation; switch (deviceOrientation) { case UIDeviceOrientation.LandscapeLeft: newOrientation = UIInterfaceOrientation.LandscapeLeft; break; case UIDeviceOrientation.LandscapeRight: newOrientation = UIInterfaceOrientation.LandscapeRight; break; case UIDeviceOrientation.Portrait: newOrientation = UIInterfaceOrientation.Portrait; break; case UIDeviceOrientation.PortraitUpsideDown: newOrientation = UIInterfaceOrientation.PortraitUpsideDown; break; default: return(false); } // Detect whether a view should be rotated return(this.viewController.ShouldAutorotateToInterfaceOrientation(newOrientation)); }
private void AddObservers() { UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications(); NSNotificationCenter.DefaultCenter.AddObserver(UIDevice.OrientationDidChangeNotification, DeviceOrientationDidChange); NSNotificationCenter.DefaultCenter.AddObserver(new NSString("FPNewPopoverPresented"), WillPresentNewPopover); _deviceOrientation = UIDevice.CurrentDevice.Orientation; }
void DeviceOrientationDidChange(NSNotification notification) { _deviceOrientation = UIDevice.CurrentDevice.Orientation; UIView.Animate(0.2, delegate { SetupView(); } ); }
void PageLayoutChanged(object sender, EventArgs e) { if (OnceInitializeAction == null && _previousOrientation != UIDevice.CurrentDevice.Orientation) { _formsLayout.Layout(_nativePage.Bounds.ToRectangle()); _formsLayout.LayoutChildren(); } _previousOrientation = UIDevice.CurrentDevice.Orientation; }
public override void ViewDidLoad() { base.ViewDidLoad(); this.currentOrientation = UIDevice.CurrentDevice.Orientation; NavigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); NavigationBar.ShadowImage = new UIImage(); DrawShadow(); InteractivePopGestureRecognizer.Delegate = new PopDelegate(Element); }
private void GoToDescription(UIImage image, UIDeviceOrientation orientation) { var descriptionViewController = new DescriptionViewController(new List <Tuple <NSDictionary, UIImage> >() { new Tuple <NSDictionary, UIImage>(null, image) }, "jpg", orientation); NavigationController.PushViewController(descriptionViewController, true); }
/// <summary> /// Convert UIDeviceOrientation to UIInterfaceOrientation. /// </summary> /// <param name="orientation"></param> /// <returns>Current orientation of the device.</returns> public static UIInterfaceOrientationMask ConvertToOrientationToMask(UIDeviceOrientation orientation) { return(orientation switch { UIDeviceOrientation.LandscapeLeft => UIInterfaceOrientationMask.LandscapeLeft, UIDeviceOrientation.LandscapeRight => UIInterfaceOrientationMask.LandscapeLeft, UIDeviceOrientation.Portrait => UIInterfaceOrientationMask.Portrait, UIDeviceOrientation.PortraitUpsideDown => UIInterfaceOrientationMask.PortraitUpsideDown, _ => UIInterfaceOrientationMask.All, });
protected override void OnOrientationChanged(UIDeviceOrientation orientation) { base.OnOrientationChanged(orientation); if (!base.IsNewOrientation(orientation)) { return; } this.deviceOrientation = orientation; this.UpdateUI(); }
public override void EditorSave() { base.EditorSave(); UIDeviceType deviceType = UILayoutManager.DeviceType; if (deviceType != UIDeviceType.Phone) { if (deviceType == UIDeviceType.Tablet) { UIDeviceOrientation orientation = UILayoutManager.Orientation; if (orientation != UIDeviceOrientation.Portrait) { if (orientation == UIDeviceOrientation.LandscapeRight || orientation == UIDeviceOrientation.LandscapeLeft) { if (this.tabletLandscape == null) { this.tabletLandscape = new UICanvasScalerData(); } this.tabletLandscape = UICanvasScalerData.FromCanvas(this.transform); } } else { if (this.tabletPortrait == null) { this.tabletPortrait = new UICanvasScalerData(); } this.tabletPortrait = UICanvasScalerData.FromCanvas(this.transform); } } } else { switch (UILayoutManager.Orientation) { case UIDeviceOrientation.Portrait: case UIDeviceOrientation.PortraitUpsideDown: if (this.phonePortrait == null) { this.phonePortrait = new UICanvasScalerData(); } this.phonePortrait = UICanvasScalerData.FromCanvas(this.transform); break; case UIDeviceOrientation.LandscapeRight: case UIDeviceOrientation.LandscapeLeft: if (this.phoneLandscape == null) { this.phoneLandscape = new UICanvasScalerData(); } this.phoneLandscape = UICanvasScalerData.FromCanvas(this.transform); break; } } }
private static bool IsSameOrientationKind(UIDeviceOrientation o1, UIDeviceOrientation o2) { if (o1 == UIDeviceOrientation.FaceDown || o1 == UIDeviceOrientation.FaceUp) return (o2 == UIDeviceOrientation.FaceDown || o2 == UIDeviceOrientation.FaceUp); if (o1 == UIDeviceOrientation.LandscapeLeft || o1 == UIDeviceOrientation.LandscapeRight) return (o2 == UIDeviceOrientation.LandscapeLeft || o2 == UIDeviceOrientation.LandscapeRight); if (o1 == UIDeviceOrientation.Portrait || o1 == UIDeviceOrientation.PortraitUpsideDown) return (o2 == UIDeviceOrientation.Portrait || o2 == UIDeviceOrientation.PortraitUpsideDown); return false; }
public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator) { base.ViewWillTransitionToSize(toSize, coordinator); // Note that the app delegate controls the device orientation notifications required to use the device orientation. UIDeviceOrientation deviceOrientation = UIDevice.CurrentDevice.Orientation; if (deviceOrientation.IsPortrait() || deviceOrientation.IsLandscape()) { var previewLayer = (AVCaptureVideoPreviewLayer)PreviewView.Layer; previewLayer.Connection.VideoOrientation = (AVCaptureVideoOrientation)(long)deviceOrientation; } }
public static DisplayOrientation UIDeviceOrientationToDisplayOrientation(UIDeviceOrientation orientation) { switch (orientation) { case UIDeviceOrientation.FaceDown: return DisplayOrientation.FaceDown; case UIDeviceOrientation.FaceUp: return DisplayOrientation.FaceUp; default: case UIDeviceOrientation.LandscapeLeft: return DisplayOrientation.LandscapeLeft; case UIDeviceOrientation.LandscapeRight: return DisplayOrientation.LandscapeRight; case UIDeviceOrientation.Portrait: return DisplayOrientation.Portrait; case UIDeviceOrientation.PortraitUpsideDown: return DisplayOrientation.PortraitUpsideDown; } }
public static DisplayOrientation UIDeviceOrientationToDisplayOrientation(UIDeviceOrientation orientation) { switch (orientation) { case UIDeviceOrientation.FaceDown: return DisplayOrientation.Unknown; case UIDeviceOrientation.FaceUp: return DisplayOrientation.Unknown; default: // NOTE: in XNA, Orientation Left is a 90 degree rotation counterclockwise, while on iOS // it is a 90 degree rotation CLOCKWISE. They are BACKWARDS! case UIDeviceOrientation.LandscapeLeft: return DisplayOrientation.LandscapeRight; case UIDeviceOrientation.LandscapeRight: return DisplayOrientation.LandscapeLeft; case UIDeviceOrientation.Portrait: return DisplayOrientation.Portrait; case UIDeviceOrientation.PortraitUpsideDown: return DisplayOrientation.PortraitDown; } }
public static UIImage CreateScreenshot(this ARSCNView view, UIDeviceOrientation interfaceOrientation) { if (view.Session.CurrentFrame == null) { return(null); } var ciImage = new CIImage(view.Session.CurrentFrame.CapturedImage); // TODO: check var keys = new NSString[] { CIFilterInputKey.Scale, CIFilterInputKey.AspectRatio }; var objects = new NSNumber[] { new NSNumber(0.5f), new NSNumber(1f) }; var dictionary = NSDictionary.FromObjectsAndKeys(objects, keys); var scaledImage = ciImage.CreateByFiltering("CILanczosScaleTransform", dictionary); var context = new CIContext(new CIContextOptions { UseSoftwareRenderer = false }); var cgimage = context.CreateCGImage(scaledImage, scaledImage.Extent); if (cgimage != null) { var orientation = UIImageOrientation.Right; switch (interfaceOrientation) { case UIDeviceOrientation.Portrait: orientation = UIImageOrientation.Right; break; case UIDeviceOrientation.PortraitUpsideDown: orientation = UIImageOrientation.Left; break; case UIDeviceOrientation.LandscapeLeft: orientation = UIImageOrientation.Up; break; case UIDeviceOrientation.LandscapeRight: orientation = UIImageOrientation.Down; break; } return(new UIImage(cgimage, 1f, orientation)); } return(null); }
int exifOrientation(UIDeviceOrientation orientation) { ExifKind exifOrientation; /* kCGImagePropertyOrientation values * The intended display orientation of the image. If present, this key is a CFNumber value with the same value as defined * by the TIFF and EXIF specifications -- see enumeration of integer constants. * The value specified where the origin (0,0) of the image is located. If not present, a value of 1 is assumed. * * used when calling featuresInImage: options: The value for this key is an integer NSNumber from 1..8 as found in kCGImagePropertyOrientation. * If present, the detection will be done based on that orientation but the coordinates in the returned features will still be based on those of the image. */ switch (orientation) { case UIDeviceOrientation.PortraitUpsideDown: // Device oriented vertically, home button on the top exifOrientation = ExifKind.LEFT_0COL_BOTTOM; break; case UIDeviceOrientation.LandscapeLeft: // Device oriented horizontally, home button on the right if (this.isUsingFrontFacingCamera) { exifOrientation = ExifKind.BOTTOM_0COL_RIGHT; } else { exifOrientation = ExifKind.TOP_0COL_LEFT; } break; case UIDeviceOrientation.LandscapeRight: // Device oriented horizontally, home button on the left if (this.isUsingFrontFacingCamera) { exifOrientation = ExifKind.TOP_0COL_LEFT; } else { exifOrientation = ExifKind.BOTTOM_0COL_RIGHT; } break; case UIDeviceOrientation.Portrait: // Device oriented vertically, home button on the bottom default: exifOrientation = ExifKind.RIGHT_0COL_TOP; break; } return((int)exifOrientation); }
private static Boolean IsSameOrientationKind(UIDeviceOrientation o1, UIDeviceOrientation o2) { if (o1 == UIDeviceOrientation.FaceDown || o1 == UIDeviceOrientation.FaceUp) { return(o2 == UIDeviceOrientation.FaceDown || o2 == UIDeviceOrientation.FaceUp); } if (o1 == UIDeviceOrientation.LandscapeLeft || o1 == UIDeviceOrientation.LandscapeRight) { return(o2 == UIDeviceOrientation.LandscapeLeft || o2 == UIDeviceOrientation.LandscapeRight); } if (o1 == UIDeviceOrientation.Portrait || o1 == UIDeviceOrientation.PortraitUpsideDown) { return(o2 == UIDeviceOrientation.Portrait || o2 == UIDeviceOrientation.PortraitUpsideDown); } return(false); }
private bool GetShouldRotate6(UIDeviceOrientation orientation) { if (!this.viewController.ShouldAutorotate()) return false; UIInterfaceOrientationMask mask = UIInterfaceOrientationMask.Portrait; switch (orientation) { case UIDeviceOrientation.LandscapeLeft: mask = UIInterfaceOrientationMask.LandscapeLeft; break; case UIDeviceOrientation.LandscapeRight: mask = UIInterfaceOrientationMask.LandscapeRight; break; case UIDeviceOrientation.Portrait: mask = UIInterfaceOrientationMask.Portrait; break; case UIDeviceOrientation.PortraitUpsideDown: mask = UIInterfaceOrientationMask.PortraitUpsideDown; break; default: return false; } return this.viewController.GetSupportedInterfaceOrientations().HasFlag(mask); }
private bool GetShouldRotate(UIDeviceOrientation orientation) { UIInterfaceOrientation iorientation = UIInterfaceOrientation.Portrait; switch (orientation) { case UIDeviceOrientation.LandscapeLeft: iorientation = UIInterfaceOrientation.LandscapeLeft; break; case UIDeviceOrientation.LandscapeRight: iorientation = UIInterfaceOrientation.LandscapeRight; break; case UIDeviceOrientation.Portrait: iorientation = UIInterfaceOrientation.Portrait; break; case UIDeviceOrientation.PortraitUpsideDown: iorientation = UIInterfaceOrientation.PortraitUpsideDown; break; default: return false; } return this.viewController.ShouldAutorotateToInterfaceOrientation(iorientation); }
bool IsDeviceLandscape (UIDeviceOrientation orientation) { return orientation == UIDeviceOrientation.LandscapeLeft || orientation == UIDeviceOrientation.LandscapeRight; }
public static DeviceOrientation ToCor(UIDeviceOrientation monoTouch) { switch (monoTouch) { case UIDeviceOrientation.FaceDown: return DeviceOrientation.Default; case UIDeviceOrientation.FaceUp: return DeviceOrientation.Default; case UIDeviceOrientation.LandscapeLeft: return DeviceOrientation.Leftside; case UIDeviceOrientation.LandscapeRight: return DeviceOrientation.Rightside; case UIDeviceOrientation.Portrait: return DeviceOrientation.Default; case UIDeviceOrientation.PortraitUpsideDown: return DeviceOrientation.Upsidedown; default: Console.WriteLine ("WARNING: Unknown device orientaton: " + monoTouch); return DeviceOrientation.Default; } }
static bool TryConvertToVideoOrientation (UIDeviceOrientation orientation, out AVCaptureVideoOrientation result) { switch (orientation) { case UIDeviceOrientation.Portrait: result = AVCaptureVideoOrientation.Portrait; return true; case UIDeviceOrientation.PortraitUpsideDown: result = AVCaptureVideoOrientation.PortraitUpsideDown; return true; case UIDeviceOrientation.LandscapeLeft: result = AVCaptureVideoOrientation.LandscapeRight; return true; case UIDeviceOrientation.LandscapeRight: result = AVCaptureVideoOrientation.LandscapeLeft; return true; default: result = 0; return false; } }
private AVCaptureVideoOrientation OrientationFromDeviceOrientation (UIDeviceOrientation orientation) { AVCaptureVideoOrientation retOrientation; switch (orientation){ case UIDeviceOrientation.PortraitUpsideDown: retOrientation = AVCaptureVideoOrientation.PortraitUpsideDown; break; case UIDeviceOrientation.Portrait: retOrientation = AVCaptureVideoOrientation.Portrait; break; case UIDeviceOrientation.LandscapeLeft: retOrientation = AVCaptureVideoOrientation.LandscapeLeft; break; case UIDeviceOrientation.LandscapeRight: retOrientation = AVCaptureVideoOrientation.LandscapeRight; break; default: retOrientation = (AVCaptureVideoOrientation)0; break; } return retOrientation; }
private static bool IsValidInterfaceOrientation(UIDeviceOrientation self) { return (self != UIDeviceOrientation.FaceUp && self != UIDeviceOrientation.FaceDown && self != UIDeviceOrientation.Unknown); }
static AVCaptureVideoOrientation OrientationFromDeviceOrientation(UIDeviceOrientation orientation) { switch (orientation) { case UIDeviceOrientation.PortraitUpsideDown: return AVCaptureVideoOrientation.PortraitUpsideDown; case UIDeviceOrientation.Portrait: return AVCaptureVideoOrientation.Portrait; case UIDeviceOrientation.LandscapeLeft: return AVCaptureVideoOrientation.LandscapeLeft; case UIDeviceOrientation.LandscapeRight: return AVCaptureVideoOrientation.LandscapeRight; default: return (AVCaptureVideoOrientation) 0; } }
private void OnOrientationChanged(NSNotification notif) { orientation = UIDevice.CurrentDevice.Orientation; }
AVCaptureVideoOrientation VideoOrientationFor (UIDeviceOrientation deviceOrientation) { switch (deviceOrientation) { case UIDeviceOrientation.Portrait: return Portrait; case UIDeviceOrientation.PortraitUpsideDown: return PortraitUpsideDown; case UIDeviceOrientation.LandscapeLeft: return LandscapeLeft; case UIDeviceOrientation.LandscapeRight: return LandscapeLeft; default: throw new InvalidProgramException (); } }