Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModalViewController transparent background iOS 8

Tags:

Opened old project in Xcode 6 and found issue that background is not transparent in presented view controller. I have used solution in the topic below and it worked so far in ios7. iOS : ModalView with background transparent?

Please advice how to deal with iOS 8.

like image 993
Madman Avatar asked Sep 01 '14 11:09

Madman


2 Answers

Try setting the modalPresentationStyle property of the presented view controller to the new UIModalPresentationOverCurrentContext constant e.g.

[_modalViewController setModalPresentationStyle:UIModalPresentationOverCurrentContext]
like image 185
mmccomb Avatar answered Oct 27 '22 00:10

mmccomb


mmccomb's solution eventually worked for me, but I had to tweak a couple of things. Hopefully these details help someone:

1) I had to set the property of the presented view controller from the presenting view controller, like this:

MyViewController *myVc = [segue destinationViewController];
[myVc setModalPresentationStyle:UIModalPresentationOverCurrentContext];

Setting the presentation style from within the presented VC's viewDidLoad didn't work.

2) I was using a storyboard, and I had to go into the segue properties and set the Presentation style to Default. Setting any other value gave me a black background.

like image 21
itnAAnti Avatar answered Oct 26 '22 22:10

itnAAnti