ToolbarItems在iOS上看起来不正确。

huangapple go评论65阅读模式
英文:

ToolbarItems do not look right in iOS

问题

以下是翻译好的部分:

我有一个使用FreshMvvm的Xamarin.Forms应用程序,并尝试使用辅助工具栏项。这是我的PageModel代码的一部分:

public override void Init(object initData)
{
    CurrentPage.ToolbarItems.Add(new ToolbarItem() { Text = "关于LATICRETE", Command = AboutCommand, Priority = 0, Order = ToolbarItemOrder.Secondary });
    CurrentPage.ToolbarItems.Add(new ToolbarItem() { Text = "呼叫LATICRETE", Command = CallCommand, Priority = 0, Order = ToolbarItemOrder.Secondary });
    CurrentPage.ToolbarItems.Add(new ToolbarItem() { Text = "电子邮件技术支持", Command = EmailTechSupportCommand, Priority = 0, Order = ToolbarItemOrder.Secondary });
    CurrentPage.ToolbarItems.Add(new ToolbarItem() { Text = "访问LATICRETE网站", Command = VisitWebsiteCommand, Priority = 0, Order = ToolbarItemOrder.Secondary });
}

对于Android,在按下汉堡按钮后,菜单看起来像我期望的那样:

ToolbarItems在iOS上看起来不正确。

但在iPhone上,情况大不相同:

ToolbarItems在iOS上看起来不正确。

正如您所看到的,没有汉堡按钮,并且所有的ToolbarItems都水平放置在一起,由于它们不适合屏幕的宽度,它们重叠在一起。我意识到这是iOS的正常行为,但对我来说是不可接受的。是否有任何方法可以修复它?

英文:

I have a Xamarin.Forms app with FreshMvvm, and am trying to use secondary ToolbarItems. Here is a part of my PageModel code:

  public override void Init(object initData)
  {
      CurrentPage.ToolbarItems.Add(new ToolbarItem() { Text = "About LATICRETE", Command = AboutCommand, Priority = 0, Order = ToolbarItemOrder.Secondary });
      CurrentPage.ToolbarItems.Add(new ToolbarItem() { Text = "Call LATICRETE", Command = CallCommand, Priority = 0, Order = ToolbarItemOrder.Secondary });
      CurrentPage.ToolbarItems.Add(new ToolbarItem() { Text = "Email Technical Support", Command = EmailTechSupportCommand, Priority = 0, Order = ToolbarItemOrder.Secondary });
      CurrentPage.ToolbarItems.Add(new ToolbarItem() { Text = "Visit LATICRETE Website", Command = VisitWebsiteCommand, Priority = 0, Order = ToolbarItemOrder.Secondary });

For Android, after pressing the hamburger button, the menu looks like I expect:

ToolbarItems在iOS上看起来不正确。

But at iPhone, it is quite different:

ToolbarItems在iOS上看起来不正确。

As you can see, there is no hamburger button, and all the ToolbarItems are placed horizontally next to each other, and as they do not fit withing the width of the screen, they overlap. I realize that this is the normal behavior for iOS, and yet it is not acceptable for me. Is there any way to fix it?

答案1

得分: 3

在iOS上,“Secondary”项目菜单会出现在导航栏下方,呈水平列表形式。

如果您想要实现类似Android中的效果,您可以创建一个自定义的“PageRenderer”。

这里有一个示例,您可以参考这个链接:iOSSecondaryToolbarMenubar

在Android中的效果:

ToolbarItems在iOS上看起来不正确。

在iOS中的效果(您可以在自定义的渲染器中更改图标):

1)第一页具有工具栏项目:

ToolbarItems在iOS上看起来不正确。

2)所有页面都具有工具栏项目:

ToolbarItems在iOS上看起来不正确。

英文:

On iOS, the Secondary items menu appears below the navigation bar as a horizontal list.

if you want to acheve the effect like in Android,you could create a custom PageRenderer.

here is a sample,you could refer to it iOSSecondaryToolbarMenubar

the effect in Android :

ToolbarItems在iOS上看起来不正确。

the effect in ios (you could change the icon in your renderer):

  1. the first page has the toolbar items:
    ToolbarItems在iOS上看起来不正确。

  2. all pages have the toolbar items:

ToolbarItems在iOS上看起来不正确。

huangapple
  • 本文由 发表于 2020年1月3日 22:06:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/59579949.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定