Hey Everyone

New to MonoTouch and I am trying to get my head around the
UIMenuController. I haven't had any luck finding MonoTouch examples and the
Objective C ones don't really translate.

I am trying to display a UIMenuController to a UIBarButton Item when it is
clicked. I have written some code and it does run but nothing is displayed.

Here is my code:

        public override void ViewWillAppear (bool animated)
        {
            base.ViewWillAppear (animated);

            ToolbarItems = new UIBarButtonItem[] {
                new UIBarButtonItem ("Sort", UIBarButtonItemStyle.Bordered,
sort_Click)
            } ;
            NavigationController.ToolbarHidden = false;
        }

        void sort_Click (object sender, EventArgs e)
        {
            var menu = UIMenuController.SharedMenuController;
            menu.SetTargetRect
(NavigationController.Toolbar.Subviews[1].Frame, this.View.Superview);

            menu.MenuItems = new UIMenuItem[] {
                new UIMenuItem ("Current", new Selector ("SortItOut")),
                new UIMenuItem ("Movers", new Selector ("SortItOut")),
                new UIMenuItem ("Opening", new Selector ("SortItOut")),
                new UIMenuItem ("Number", new Selector ("SortItOut"))
            } ;

            menu.SetMenuVisible (true, true);

        }

Any help will be much appreciated.

Thanks
Liam
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to