Hello,
I have the image editor working well on Android and Windows. On iOS, the app freezes, in various ways.
Testing on iOS 17.6.1. sfImageEditor versions tried: 29.1.41 and 29.2.7. Maui Version 8.0.3.
If I make no alterations at all to the control, it does work. If I try to add any customizations, the freeze occurs.
First example, in C#. In my page view constructor, I try to customize the control, but allowing any customization line to execute causes a freeze - the lines execute without error (as does all of the initialization), but the page is never displayed, and the app is frozen. Again, works fine on Android and Windows, and the problem does not occur if no customization line is added.
public ImageEditorView(ImageDataModel data)
{
InitializeComponent();
VM.ImageDataModel = data;
VM.ImagePath = Utilities.GetFullPath(data.ImagePath);
ImageEditorToolbar headerToolbar = MyImageEditor.Toolbars[0];
ImageEditorToolbar footerToolbar = MyImageEditor.Toolbars[1];
// !!! Executing any of the lines after this point will cause the freeze
headerToolbar.Orientation = ToolbarOrientation.Vertical;
headerToolbar.Position = ToolbarPosition.End;
MyImageEditor.ToolbarSettings.ColorPalette.Clear();
MyImageEditor.ToolbarSettings.ColorPalette.Add(Colors.Yellow);
MyImageEditor.SetToolbarItemVisibility("Browse", false);
MyImageEditor.SetToolbarItemVisibility("Crop", false);
}
Example 2 - xaml customization. I removde all customization from my constructor, and instead added the following xaml. In this case, the page loads, and the image editor is shown, but selecting the Pen->Fill option freezes.
<imageEditor:SfImageEditor
x:Name="MyImageEditor"
Source="{Binding ImagePath}"
AnnotationSelected="MyImageEditor_AnnotationSelected"
HeightRequest="400" WidthRequest="400"
HorizontalOptions="Fill" VerticalOptions="Fill">
<imageEditor:SfImageEditor.ToolbarSettings>
<imageEditor:ImageEditorToolbarSettings>
<imageEditor:ImageEditorToolbarSettings.ColorPalette>
<Color>Yellow</Color>
<Color>Red</Color>
<Color>White</Color>
<Color>Black</Color>
<Color>Blue</Color>
<Color>Chartreuse</Color>
</imageEditor:ImageEditorToolbarSettings.ColorPalette>
</imageEditor:ImageEditorToolbarSettings>
</imageEditor:SfImageEditor.ToolbarSettings>
</imageEditor:SfImageEditor>
Please let me know what I can do to allow the control to work successfully with my customizations on iOS.
Thanks
I believe I have figured out the issue.
It appears that this is due to the sfImageEditor control not having its MinimumHeightRequest and MinimumWidthRequest set.
I saw that the documentation said they needed to be set, but I ended up leaving them out through various edits, and also not seeing them make any difference.
Apparently, they do make a difference :)
So far, in testing with those values set, the control is working as expected on iOS.
Hi Stan,
Thank you for the update! We're glad to hear you've identified the cause of the
issue.
Based on your findings, we suspect that the SfImageEditor might be placed inside a layout with unbounded (infinite) size, such as a ScrollView or StackLayout. In such cases, it's necessary to explicitly set the MinimumHeightRequest and MinimumWidthRequest, as the control's default size is 100x100. You can adjust these values as needed to match your layout requirements.
Thanks for
sharing your findings with us; it's a helpful insight for others who might
encounter similar scenarios. Please don't hesitate to reach out if you need any
further assistance!
Regards,
Tamilarasan G.