模態彈出全屏遮蔽

代碼我用自己寫的demo代碼,效果是我的項目效果

#RootViewController.h中
//  Copyright ? 2016年 糖糖. All rights reserved.
//

#import "ViewController.h"

#import "ShareController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"測試";
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"模態彈出全屏" style:UIBarButtonItemStyleDone target:self action:@selector(ActionShare)];
}


- (void)ActionShare{
    
    ShareController *lagerPicVC = [[ShareController alloc]init];
    
// 這里面有很多枚舉值,你可以去試試    lagerPicVC.modalPresentationStyle=UIModalPresentationOverFullScreen;;//關鍵語句,必須有
    
    [self presentViewController:lagerPicVC animated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

ShareController.m中

//  Copyright ? 2016年 糖糖. All rights reserved.
//

#import "ShareController.h"

@interface ShareController ()

@end

@implementation ShareController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [[UIColor grayColor] colorWithAlphaComponent:0.5];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

效果圖,項目的效果圖

項目效果圖
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容