How to display the image editor in safe area in Xamarin.iOS?
This article explains how to view the Xamarin.iOS Image Editor in safe area to avoid the notch overriding problem with the Syncfusion Xamarin.iOS SfImageEditor.
In iOS 11, a few new visual design updates like including safe area layout guides and large titles has been introduced. If you run application on an iPhone X, then top area will be cropped. To overcome this, please follow these steps:
Step 1: Create an image editor sample with all necessary assemblies.
Step 2: Set the TranslatesAutoresizingMaskIntoConstraints property as false and then adjust the SfImageEditor’s Frame based on SafeAreaInsets. Please refer the following code sample.
… SfImageEditor imageEditor = new SfImageEditor(); imageEditor.TranslatesAutoresizingMaskIntoConstraints = false; imageEditor.Image = UIImage.FromBundle("Image.jpeg"); var insets= UIApplication.SharedApplication.Windows[0].SafeAreaInsets; imageEditor.Frame = new CoreGraphics.CGRect( this.View.Frame.X, this.View.Frame.Y + insets.Top, this.View.Frame.Width, this.View.Frame.Height - (insets.Top + insets.Bottom)); View.AddSubview(imageEditor); …
Screenshot: {Before using SafeArea}
Screenshot: {After using SafeArea}
See also
How to add a text on image programmatically
What are the shapes available in SfImageEditor
How to crop a desired portion of an image
Conclusion
I hope you enjoyed learning about how to display the image editor in a safe area in Xamarin.iOS.
You can refer to our Xamarin.iOS SfImageEditor feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Xamarin.iOS SfImageEditor example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!