0

I want to show a modal view via my navigation controller, and background of this view should be transparent. In the modal view controller I clear background on viewDidLoad as follow:

self.view.backgroundColor = [UIColor clearColor];

I show this view as follow:

ModalViewController *modalViewController = [[ModalViewController alloc] init];
[self.navigationController presentViewController:modalViewController animated:YES completion:nil];

As result my view is shown, but background is black. I've tried to do:

[self setModalPresentationStyle:UIModalPresentationCurrentContext];

For all my view controllers, include NavigationController. I've tried to do:

self.navigationController.providesPresentationContextTransitionStyle = YES;
self.navigationController.definesPresentationContext = YES;

However all of this doesn't work. Is it possible to implement my task, or I should show my view using another way?

Mirimon
  • 102
  • 5

2 Answers2

0

Have you checked out this question on SO Display clearColor UIViewController over UIViewController?

It seems to have the answer to your question. Basically you have to set presentation style to 'UIModalPresentationCurrentContext'.

Community
  • 1
  • 1
indrajit
  • 99
  • 4
0

I used UIModalPresentationCurrentContext instead of the UIModalPresentationOverCurrentContext. Using the UIModalPresentationOverCurrentContext fixed this issue.

Mirimon
  • 102
  • 5