我想在 Xamarin.iOS 中实现弹出导航。为此,我使用 FlyoutNavigationController,到目前为止效果良好。
但现在我必须在弹出菜单内的导航列表下方显示一些附加内容(基本上是图像、一些标签和按钮)。为此,我想使用保存菜单项的“部分”控件的 FooterView 属性。
当我设置时
section.Footer = "Test";
它可以工作(我可以看到文本),但是当我使用“FooterView”属性时,什么也没有显示:
public class ViewController : UIViewController
{
FlyoutNavigationController navigation;
private const string PageNamePage1 = "The first page";
private const string PageNamePage2 = "The second page";
readonly string[] pages =
{
PageNamePage1,
PageNamePage2
};
public override void ViewDidLoad()
{
base.ViewDidLoad();
navigation = new FlyoutNavigationController
{
View =
{
Frame = UIScreen.MainScreen.Bounds
}
};
View.AddSubview(navigation.View);
var elements = pages.Select(page => new StringElement(page) as Element);
navigation.NavigationRoot = new RootElement("Induserv App");
var section = new Section();
section.AddAll(elements);
var uiTextView = new UITextView {Text = "--> This won't show!"};
section.FooterView = new UIView
{
uiTextView
};
navigation.NavigationRoot.Add(section);
navigation.ViewControllers = new UIViewController[]
{
new UINavigationController(new Page1Controller(navigation, PageNamePage1)),
new UINavigationController(new Page2Controller(navigation, PageNamePage2)),
};
}
}
有人知道在这里显示此页脚需要什么吗?还有其他方法可以在此面板中放置一些控件吗?
最佳答案
为页脚 View 和 uiTextView 设置框架,如下所示:
var uiTextView = new UITextView(new RectangleF(0, 0, 10, 10)) {Text = "--> This won't show!"};
section.FooterView = new UIView(new RectangleF(0, 0, 10, 10))
{
uiTextView
};
关于ios - Xamarin FlyoutNavigationController 不显示部分 FooterView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23247631/