如何创建帮助叠加,iOS

时间:2015-11-06 10:26:06

标签: ios objective-c iphone swift overlay

我正在尝试执行如下图所示的帮助叠加,我该怎么做?

enter image description here

2 个答案:

答案 0 :(得分:1)

您可以在Photoshop中为每个iPhone大小制作一个叠加图像,其alpha值为50,然后将该图像添加到UIImageView CGRect self.view.frame的{​​{1}}中,并控制隐藏和取消隐藏在图片上的UIGestureRecognizer

或者您只需制作一张背景色为UIView的{​​{1}},然后添加每个人"手"在这个视图中你想要它们的图像。

答案 1 :(得分:1)

喜欢

<强>目标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];

你可以从superview中删除它:

[TransprentView removeFromSuperview];

Swift 2&amp;上述

 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)

你可以从superview中删除它:

    TransprentView.removeFromSuperview()