在Xamarin Visual Studio 17中为ios创建自定义工具栏

时间:2019-03-19 14:37:07

标签: xamarin.forms

我想创建一个带有应用程序名称和其图标的自定义工具栏,该工具栏应包含在应用程序的所有页面中。此工具栏应适用于ios,因为在所有其他示例中,我都看到它们正在使用Visual Studio 17中没有的Main.storyboard。谢谢

1 个答案:

答案 0 :(得分:0)

  

我想创建一个自定义工具栏,其中包含应用名称和该图标的图标

您可以参考this official document来了解有关Xamarin Forms中ToolBarItem的更多信息。

Xaml 中的代码如下:

router.post('/:recipeID/steps',checkAuth, (req, res, next) => {
  // Add Steps to recipeID if it exists
});

或在 ContentPage 中:

<ContentPage.ToolbarItems>
    <ToolbarItem Name="MenuItem1" Icon="icon.png" Priority="0" Order="Primary"  />
</ContentPage.ToolbarItems>

可以在ContentPage中使用 Title 属性设置此应用名称,如下所示:

 new ToolbarItem () { Icon = "icon.png" }

这里很好的article供参考。