mono / monotouch-bindings

A collection of third party bindings for MonoTouch
450 stars 357 forks source link

WEPopover exception when calling PresentFromBarButtonItem #219

Open andreinitescu opened 10 years ago

andreinitescu commented 10 years ago

I am using the WEPopover binding from the MonoTouch sample and it throws the following exception when calling PresentFromBarButtonItem:

Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[UIBarButtonItem frameInView:]: unrecognized selector sent to instance 0x7e4e1330

My code is:

Popover.Initialize ();
Popover.ShouldDismiss = true;
Popover.ContentViewController = new UIViewController() {
            View = label,
            PreferredContentSize = contentSize,
            ContentSizeForViewInPopover = contentSize
};

var btnSlideMenu = this.NavigationItem.LeftBarButtonItems.First ();
Popover.PresentFromBarButtonItem (
            btnSlideMenu, 
            UIPopoverArrowDirection.Down, 
            true);

It works fine when using PresentFromRect

How to make it work?