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

2017-12-27  本文已影响0人  AqiY

场景 : 电商类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;

}

上一篇 下一篇

猜你喜欢

热点阅读