문제

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