Xamarin IOS飞出导航

时间:2015-05-10 22:25:58

标签: xamarin xamarin.ios

我正在为IOS使用此Fly Out导航,我想在顶部的导航中添加图像和文本,我该怎么做?

有点像这样的https://github.com/garuma/FlyOutMenu,它说的是一个标题,但是我用图像和文字替换了那个用Clancey Fly Out Navigation如何做到这一点

https://github.com/Clancey/FlyoutNavigation

编辑:这是我试过的

public override void ViewDidLoad ()
{
    base.ViewDidLoad ();
    var navigation = new FlyoutNavigationController {
        // Create the navigation menu
        NavigationRoot = new RootElement ("Navigation") {
MonkeyImage.Image = UIImage.FromBundle ("PurpleMonkey"); // This is what i tried adding here but it does not seen to work
            new Section ("Pages") {
                new StringElement ("Animals"),
                new StringElement ("Vegetables"),
                new StringElement ("Minerals"),
            }
        },
        // Supply view controllers corresponding to menu items:
        ViewControllers = new [] {
            new UIViewController { View = new UILabel { Text = "Animals (drag right)" } },
            new UIViewController { View = new UILabel { Text = "Vegetables (drag right)" } },
            new UIViewController { View = new UILabel { Text = "Minerals (drag right)" } },
        },
    };

1 个答案:

答案 0 :(得分:0)

使用" ImageElement"将图像添加到FlyOut。

public override void ViewDidLoad ()

{

    base.ViewDidLoad ();
    var navigation = new FlyoutNavigationController {
        // Create the navigation menu
        NavigationRoot = new RootElement ("Navigation") {
MonkeyImage.Image = UIImage.FromBundle ("PurpleMonkey"); // This is what i tried adding here but it does not seen to work
                new Section ("") {
                new ImageElement (UIImage.FromBundle ("PurpleMonkey")),
            },
                new Section ("Pages") {
                new StringElement ("Animals"),
                new StringElement ("Vegetables"),
                new StringElement ("Minerals"),
            }
        },
        // Supply view controllers corresponding to menu items:
        ViewControllers = new [] {
            new UIViewController { View = new UILabel { Text = "Animals (drag right)" } },
            new UIViewController { View = new UILabel { Text = "Vegetables (drag right)" } },
            new UIViewController { View = new UILabel { Text = "Minerals (drag right)" } },
        },
    };