如何更改Xamarin.Forms选项卡栏高度(iOS)
如何在Xamarin.Forms(iOS)中更改选项卡栏的高度?是否可以使用TabbedRenderer?是的,这可以从如何更改Xamarin.Forms选项卡栏高度(iOS),xamarin,xamarin.forms,Xamarin,Xamarin.forms,如何在Xamarin.Forms(iOS)中更改选项卡栏的高度?是否可以使用TabbedRenderer?是的,这可以从自定义渲染器进行修改 您需要在Forms项目中将选项卡页子类化,并使用此类导出渲染 然后在CustomRenderer中重写ViewWillLayoutSubviews方法。比如: public class MyTabbedPageRenderer : TabbedRenderer { // Modify this variable with the height yo
自定义渲染器进行修改
您需要在Forms项目中将选项卡页
子类化,并使用此类导出渲染
然后在CustomRenderer中重写ViewWillLayoutSubviews
方法。比如:
public class MyTabbedPageRenderer : TabbedRenderer
{
// Modify this variable with the height you desire.
private readonly float tabBarHeight = 55f;
public override void ViewWillLayoutSubviews()
{
base.ViewWillLayoutSubviews();
TabBar.Frame = new CGRect(TabBar.Frame.X, TabBar.Frame.Y + (TabBar.Frame.Height - tabBarHeight), TabBar.Frame.Width, tabBarHeight);
}
}
希望这能有所帮助。-很抱歉,让这个旧线程死灰复燃,但这种方法似乎不再有效。有什么想法吗?好的,在当前版本中(对我来说是XF 4.4),这必须在ViewDidLayoutSubviews
中完成。