14th January 2015

Transparent Background Modal View

Guides By 2 years ago

I wanted to create a modal View Controller that would have a transparent background but when I tried setting the alpha of the background to 0.5 it just made the view behind it completely black. This is because the background views are being removed after the transition.



Screen Shot 2015-01-14 at 9.41.19 pm

To allow the modal view to have a see through background you have to add the following code.

In the presenting View Controller add the following code if you want to support iOS7.

//	For iOS modal presentation style must be set on presenting view controller.
	if ([UIDevice currentDevice].systemVersion.integerValue >= 7)
		[self setModalPresentationStyle:UIModalPresentationCurrentContext];
	[self presentViewController:seeThroughViewController animated:YES completion:nil]; 

In the modal View Controller code add the following code

//	Allows the presenting View Controller to be seen through the modal view controller
[self setModalPresentationStyle:UIModalPresentationCustom];


Screen Shot 2015-01-14 at 9.39.52 pm



The Background View is no longer removed and can be seen behind the transparent modal view.

Recommended Posts

Yammer integrations in ReactJS

Post by 2 years ago

I am writing this blog while I am working on a project for our client’s intranet website. The client requires the website has the ability to share, like and write comments in the website through

Got an idea?

We help entrepreneurs, organizations and established brands from around
the country bring ideas to life. We would love to hear from you!