Pompair
Pompair

Reputation: 7319

MonoTouch and UIPopoverController

I have a iPad app with the following code tied to a button's (bMyDocuments) TouchDown event handler:

UIPopoverController uipoc = new UIPopoverController(new Pop2());
uipoc.PopoverContentSize = new SizeF(200f, 300f);
uipoc.PresentFromRect (bMyDocuments.Frame, v, UIPopoverArrowDirection.Up, true);

Pop2 is a blank UIViewController with the default view (white background, no ui elements).

This code produces a popover from the button, and the size is correct. However the app hangs without any errors, and popover won't disappear when clicking outside of it.

How can I initialize UIPopoverController correctly? Sample code?

thanks,

pom

Upvotes: 2

Views: 2936

Answers (1)

chrisntr
chrisntr

Reputation: 2208

Chances are that the garbage collector is eating up your UIPopoverController. Try declaring your UIPopovercontroller as a class variable instead of inside your TouchDown event and see how that goes.

Cheers,

ChrisNTR

Upvotes: 8

Related Questions