美文网首页糖糖的iOS专题
模态弹出全屏遮蔽

模态弹出全屏遮蔽

作者: 我的梦想之路 | 来源:发表于2016-08-03 08:39 被阅读124次

    代码我用自己写的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
    

    效果图,项目的效果图

    项目效果图

    相关文章

      网友评论

      本文标题:模态弹出全屏遮蔽

      本文链接:https://www.haomeiwen.com/subject/nlzfsttx.html