开发者

Monotouch - iPad Simulator issue with UIPopoverController

开发者 https://www.devze.com 2023-03-16 15:11 出处:网络
I\'m getting the fol开发者_StackOverflow社区lowing error, only on the simulator and not on the iPad itself!

I'm getting the fol开发者_StackOverflow社区lowing error, only on the simulator and not on the iPad itself!

Monotouch.Foundation.MonoTouchException has been thrown 
"Objective-C exception thrown. Name: NSGenericException 
Reason: - [UIPopoverController dealloc] reached while popover is still visible."

Has anyone got an idea how to solve this?


This causes the problem...

private void GetPopsUps()
{           
UIPopoverController uipoc = new UIPopoverController(new PopController());
uipoc.PopoverContentSize = new SizeF(200f, 300f);
uipoc.PresentFromRect (new RectangleF(0,0, 200, 300), this.View, 
UIPopoverArrowDirection.Up, true);
}

This solves it (for me)..

UIPopoverController uipoc;
private void GetPopsUps()
{           
uipoc = new UIPopoverController(new PopController());
uipoc.PopoverContentSize = new SizeF(200f, 300f);
uipoc.PresentFromRect (new RectangleF(0,0, 200, 300), this.View, 
UIPopoverArrowDirection.Up, true);
} 


My guess is that you let the garbage collector remove the reference.

I would love to see how this is happening, so I could add a special case in the future, but for now, try keeping a reference to the UIPopover and UIPopoverController.

0

精彩评论

暂无评论...
验证码 换一张
取 消