1

我需要根据 Youtube 的最新 UI 创建选项卡式菜单,并在 Android 和 iOS 的顶部显示菜单。

Android 上的默认行为是在顶部显示菜单,这样可以正常工作。

在 iOS 上,我创建了一个自定义渲染,并使用以下代码将栏的位置更改为顶部:

UIInterfaceOrientation orientation = UIApplication.SharedApplication.StatusBarOrientation;

if (UIInterfaceOrientation.LandscapeLeft == orientation || UIInterfaceOrientation.LandscapeRight == orientation)
{
    tabSize = 32.0f;
}

CGRect tabFrame = this.TabBar.Frame;

tabFrame.Height = tabSize;

tabFrame.Y = this.View.Frame.Y;

this.TabBar.Frame = tabFrame;
this.TabBar.ContentMode = UIViewContentMode.ScaleToFill;

// Set the translucent property to NO then back to YES to
// force the UITabBar to reblur, otherwise part of the
// new frame will be completely transparent if we rotate
// from a landscape orientation to a portrait orientation.

this.TabBar.Translucent = false;
this.TabBar.Translucent = true;
//this.TabBar.Translucent = false;
this.TabBar.SetNeedsUpdateConstraints();

我的问题是底部有一些空白来补偿已经移动到顶部的栏。

有谁知道如何解决这个问题?

这个问题也在下面的帖子中,但我找不到答案。 https://forums.xamarin.com/discussion/comment/226114/#Comment_226114

4

0 回答 0