我试图在使用presentViewController
时制作透明的UIView
。问题是UIButton
或UIImageView
总是透明的,我怎么能使它们不透明呢?
targetViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"newViewController"];
targetViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[self presentViewController:targetViewController animated:YES completion:nil];
结果:https://i.stack.imgur.com/YJjBv.png
我希望UIButton
或UIImageView
是不透明的。我该怎么做呢?
不使用UIView的alpha,使用clear backgroundColor
targetViewController.view.backgroundColor = [UIColor clearColor];