iOS present出一个背景为半透明的试图

WDKChatRoomViewController *roomVC = [[WDKChatRoomViewController alloc] init];
    roomVC.titleStr = [group showTitle];
    roomVC.userId = caseEventModel.child_group_id;
    roomVC.chidGroupDic = infoDic;
    roomVC.group = group;
    
    roomVC.view.backgroundColor = [UIColor clearColor];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:roomVC];
    if ([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0) {
        nav.modalPresentationStyle=UIModalPresentationOverCurrentContext;
    }else{
        nav.modalPresentationStyle=UIModalPresentationCurrentContext;
    }
    [self.navigationController presentViewController:nav animated:YES completion: nil];

关键的代码是:

 if ([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0) {
        nav.modalPresentationStyle=UIModalPresentationOverCurrentContext;
    }else{
        nav.modalPresentationStyle=UIModalPresentationCurrentContext;
    }
原文地址:https://www.cnblogs.com/lyz0925/p/7833395.html