xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] [iOS] Navigation bar title image position is affected by toolbar and back buttons #15680

Open bondarenkod opened 1 year ago

bondarenkod commented 1 year ago

Description

Title image is not centered when navigation bar contains back button or/and toolbar buttons. I've fixed this issue, the nuget package is attached to this issue, feel free to use it or compile from the linked as repro sources.

Steps to Reproduce

  1. iOS 16+ (16.2?)
  2. NavigationPage.SetTitleIconImageSource(this, "icon_feed.png");
  3. this.ToolbarItems.Add(new ToolbarItem() { Text = "one" }); this.ToolbarItems.Add(new ToolbarItem() { Text = "two" });

Expected Behavior

fxd-1 fxd-2 fxd-3

Actual Behavior

issue-1 issue-2 issue-3 issue-4

Basic Information

Reproduction Link

Check this commit https://github.com/bondarenkod/repro-xf-titleimage-not-centered/commit/e8b13d39ee721d12236691cb8b224dc581fe7f55 This is XF project adopted to use with VS2022 for Windows and the latest VS2022 for Mac. You need to run the .Xamarin.Forms.vs2022.iOS.slnf file and deploy the titleview.iOS project.

Workaround

Check these changes https://github.com/bondarenkod/repro-xf-titleimage-not-centered/commit/e8b13d39ee721d12236691cb8b224dc581fe7f55

Compiled nuget based on the repro: Xamarin.Forms.5.0.0.2548.zip