Not really - I know mine didn't work until I set the focus... it's possible that that component can't be used in the way you want.... (tho I dont know :) )
On Fri, Jul 6, 2012 at 12:42 PM, Liam <[email protected]> wrote: > Hi Nic > > Thanks for the reply. > > I have tried your suggestion but still no luck. > > Any other ideas? Is there an easier option than using the UIMenuController? > I am trying to do something like a context menu in android. > > Thanks > Liam > > > On 06/07/12 21:45, Nic Wise wrote: >> >> To get mine to show, I had to set the focus - aka BecomeFirstResponder(); >> >> 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")) >> } ; >> >> BecomeFirstResponder(); //not sure if you can do it on a >> button - but that would make sense... I normally do it on the overall >> view I'm using >> >> menu.SetMenuVisible (true, true); >> >> } >> >> On Fri, Jul 6, 2012 at 8:50 AM, Liam Houlahan<[email protected]> >> wrote: >>> >>> 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 >>> [email protected] >>> http://lists.ximian.com/mailman/listinfo/monotouch >>> >> >> > _______________________________________________ > MonoTouch mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/monotouch -- Nic Wise t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise b. http://www.fastchicken.co.nz/ Earnest: Self-employed? Track your business expenses and income. http://earnestapp.com Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p mobileAgent (for FreeAgent): get your accounts in your pocket. http://goo.gl/IuBU Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2 _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
