質問

Hello i need to prevent my popover from dismissing when clicking outside the box.

I found some answers but all in objective C and i cant understand it very well.

Stop UIPopover from dismissing automatically

Anyone knows how to do that in xamarin?

役に立ちましたか?

解決

UIKit's [UIPopoverControllerDelegate popoverControllerShouldDismissPopover:] translates to UIPopoverControllerDelegate.ShouldDismiss in MonoTouch.

popover.Delegate = new MyPopoverDelegate();

...

class MyPopoverDelegate : UIPopoverControllerDelegate
{
    public override bool ShouldDismiss (UIPopoverController popoverController)
    {
        return false;
    }
}

I'm not completely positive, but I believe you can also just have your main class implement the IUIPopoverControllerDelegate interface and add ShouldDismiss directly to it:

popover.Delegate = this;

...

public override bool ShouldDismiss (UIPopoverController popoverController)
{
    return false;
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top