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