ios - Xamarin FlyoutNavigationController 不显示部分 FooterView

标签 ios xamarin

我想在 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/

相关文章:

c# - 在 Xamarin Mac 中阻止鼠标气泡

c# - 如何使用 C# HttpClient PostAsync 显示上传进度

c# - Xamarin 在某些情况下不显示图像

iOS NSURLConnection 委托(delegate)问题

IOS:imageView 发生奇怪的崩溃

ios - UITableView 单元格背景颜色在滚动时折叠

c# - 由于重载方法,使用 Xamarin Android 的绑定(bind)错误

ios - Swift:添加到新 View 时,图像不会出现在 ImageView 中

ios - 基于多行 UILabel 自动调整 UIView 大小

android - 错误 - 找不到与给定名称匹配的资源(在 'MvxItemTemplate' 处,值为 '@layout/itemc')