推出半透明的ViewController

//初始化

GoodsAttrViewController  *goodsAttr = (GoodsAttrViewController*)[mainStoryboard instantiateViewControllerWithIdentifier:@"goodsAttr"];

//设置背景色(alpha:0.5)

goodsAttr.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];

if ([[[UIDevice currentDevice]systemVersion]floatValue]>= 8.0) {

goodsAttr.modalPresentationStyle = UIModalPresentationOverFullScreen;

} else {

self.modalPresentationStyle = UIModalPresentationFullScreen;

}

//模态出

[self.navigationController showDetailViewController:goodsAttr sender:nil];

你可能感兴趣的:(推出半透明的ViewController)