<分区>
我正在尝试像下面这张图片那样做一个帮助叠加层,我该怎么做?
最佳答案
喜欢
objective-C
// get window screen size for frame
CGRect screensize = [[UIScreen mainScreen] bounds];
//create a new UIview with the same size for same view
UIView* TransprentView = [[UIView alloc] initWithFrame:screensize];
// change the background color to black and the opacity to 0.6 for Transparent
TransprentView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
// here add your Label, Image, etc, what ever you want
// add this TransprentView to your main view
[self.view addSubview:TransprentView];
你可以从 super View 中删除它:
[TransprentView removeFromSuperview];
Swift 2 及更高版本
let TransprentView = UIView(frame: UIScreen.mainScreen().bounds)
TransprentView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.5)
// here add your Label, Image, etc, what ever you want
self.view.addSubview(TransprentView)
你可以从 super View 中删除它:
TransprentView.removeFromSuperview()
关于ios - 如何创建帮助覆盖图,iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33564627/