Let's take a look at it first:
Use the following code to bring up a modal window and set its background transparency to 0.5. However, the background color after the prsent changes to black.
ShareVC *share = [[ShareVC alloc] init];[self presentViewController:share animated:YES completion:nil];
At first, I thought it was a problem with setting transparency or [uicolor clearcolor]. I found it was not a problem after several times. After Google, I found several reliable answers on stackoverflow ~
Why does presentmodalviewcontroller: animated: Turn the background black? Display clearcolor uiviewcontroller over uiviewcontroller:
NavigationcontrollerAndView ControllersAre designed in such a way that only one View Controller may show at a time. when a new view controller is pushed/presented the previous View Controller will be hidden by the system. so when you reduce the modal view'sAlphaYou will possibly seeWindow's backgroundcolor(Black colorYou see now ).
If you want a translucent view to slide-in over the main view, you can add the view asSubviewOf main view and animate it usingUiview animations.
Therefore, use
Uiview animationsImplementation:
if (!_isShareViewOpen) { _isShareViewOpen = YES; ShareVC *shareVC = [[ShareVC alloc] initWithNibName:@"ShareVC" bundle:nil]; shareVC.shareVC = shareVC; shareVC.awardList = self; [self.view addSubview:shareVC.view]; [UIView animateWithDuration:0.75f animations:^{ shareVC.view.frame = CGRectMake(0, 640, self.view.frame.size.width, self.view.frame.size.height); shareVC.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); } completion:^(BOOL finished) { }]; }