เมนู Xamarin Forms Shell Hamburger ไม่แสดงบน iOS ในการนำทางครั้งแรก
Aug 20 2020
ฉันมีแอปพลิเคชัน Xamarin Forms Shell พร้อมเมนูแฮมเบอร์เกอร์ เมื่อฉันเปิดแอปฉันไม่เห็นเมนูแฮมเบอร์เกอร์บน iPhone ของฉัน (แต่บน Android ของฉัน) เมื่อฉันไปที่ไหนสักแห่งและย้อนกลับไปไอคอนแฮมเบอร์เกอร์จะปรากฏขึ้นตามที่คาดไว้ สำหรับการจัดการเมนูแฮมเบอร์เกอร์ฉันใช้รหัสที่สร้างขึ้นเริ่มต้นของเทมเพลตเชลล์ของแอปและเพิ่งเพิ่มรายการเพิ่มเติมลงในเมนู


ฉันจะบอกให้เชลล์แสดงไอคอนเมนูตลอดเวลาได้อย่างไร
Github ลิงก์ไปยังโครงการ: https://github.com/NPadrutt/MoneyFox.Windows/tree/mobile-redesign
คำตอบ
1 LucasZhang-MSFT Aug 20 2020 at 18:04
มันเกิดจาก Custom Renderer
ในMoneyFox.iOS ->
ToolbarList.Sort((i1, i2) =>
{
return i1.Priority > i2.Priority
? -1 : 1;
});
foreach(ToolbarItem itm in ToolbarList)
{
if(itm.Priority < 0)
LeftNavList.Add(itm.ToUIBarButtonItem());
else
RightNavList.Add(itm.ToUIBarButtonItem());
}
navigationItem.SetLeftBarButtonItems(LeftNavList.ToArray(), false);
navigationItem.SetRightBarButtonItems(RightNavList.ToArray(), false);
โค้ดด้านบนจะจัดเรียงรายการใหม่บน NavigationBar ซึ่งจะทำให้เกิดปัญหา วิธีแก้ปัญหาที่ง่ายที่สุดคืออย่าใช้ตัวแสดงภาพ ในกรณีนี้ดูเหมือนจะไม่มีผลชัดเจน
//[assembly: ExportRenderer(typeof(ContentPage), typeof(CustomContentPageRenderer))]