Transparent + animated modal viewcontroller?

victoriavictoria SEMember ✭✭✭

Hi all, I'm trying to present a modal ViewController with a transparent background that animates up (like 'Reader' mode in Safari) on the iPhone. I can get either the animation OR the transparency to work, but not both at the same time. Am I missing something?

This works for presenting SomeViewController with a nice fly up animation:

PresentViewController(new SomeViewController(), true, null);

But the background is now black, even thought SomeViewController has its View set to BackgroundColor = UIColor.Clear. The Internet will tell you that you need to set the ModalPresentationStyle = UIModalPresentationStyle.CurrentContext on the Root VC to get the transparency to work, so I do this:

View.Window.RootViewController.ModalPrsentationStyle = UIModalPresentationStyle.CurrentContext

And that works, the background on SomeViewController shines through. But, now animation:true is ignored. Said another way: These two snippets do the same thing, should they?

View.Window.RootViewController.ModalPrsentationStyle = UIModalPresentationStyle.CurrentContext;
PresentViewController(new SomeViewController(), false, null);  // false, no animation here

and

View.Window.RootViewController.ModalPrsentationStyle = UIModalPresentationStyle.CurrentContext;
PresentViewController(new SomeViewController(), true, null);  // true, but still no animation :(
Sign In or Register to comment.