模态出一个半透明的控制器

场景 : 电商类APP弹出选择商品尺码,颜色

方法:在要present的出来的 VC 里面写

、、、

- (bo o l)returnYes{

}

、、、

- (instancetype)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil{

   self= [superinitWithNibName:nibNameOrNilbundle:nibBundleOrNil];

   if(self) {

       self.view.backgroundColor= [[UIColorblackColor]colorWithAlphaComponent:0];

       self.modalPresentationStyle=UIModalPresentationOverCurrentContext;

        [UIViewanimateWithDuration:0.3animations:^{

           self.view.backgroundColor= [[UIColorblackColor]colorWithAlphaComponent:0.5];

        }];

    }

   returnself;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。