Shimen the main contribution, respect the work of the author, please do not reprint.
If the article is helpful to you, you are welcome to donate to the author, support the Shimen, donate the amount at random, ^_^
I want to donate: Click Donate
Cocos2d-x source Download: Dot I teleport
Games Official Download:HTTP://DWZ.CN/RWTJL
Game video preview:http://dwz.cn/RzHHd
Game Development Blog:Http://dwz.cn/RzJzI
Game Source Transfer : Http://dwz.cn/Nret1
Title to achieve the following effects:
The background is a translucent mask effect, and the background disappears when clicked.
The idea of implementing a layer of masking:
1. Initialize UIView as the background layer
2. Set the Opaque property and background color of backgrounds view
3. Add Uigesturerecognizer to respond to background touch operation
4. Add a background view to the window and modify the background color where you want it to appear
5. Remove the view and modify the background color where it needs to be hidden
Part of the code:
Background init and tapped UIView *background = [[UIView alloc] Initwithframe:cgrectmake (0, 0, Self.view.bounds.size.width, Self.view.bounds.size.height)]; Background.backgroundcolor = [Uicolor colorwithwhite:0.0 alpha:0.0]; Background.opaque = NO; Uigesturerecognizer *gesture = [[UITapGestureRecognizer alloc] initwithtarget:self action: @selector (backgroundtapped :)]; [Background addgesturerecognizer:gesture]; Self.sharebackgroundview = background;
Self.shareBackGroundView.backgroundColor = [Uicolor colorwithwhite:0.0 alpha:0.3]; Appdelegate *delegate = (appdelegate *) [uiapplication sharedapplication].delegate; [Delegate.window AddSubview:self.shareBackGroundView];
Self.shareBackGroundView.backgroundColor = [Uicolor colorwithwhite:0.0 alpha:0.0]; [Self.sharebackgroundview Removefromsuperview];
Shimen the main contribution, respect the work of the author, please do not reprint.
If the article is helpful to you, you are welcome to donate to the author, support the Shimen, donate the amount at random, ^_^
I want to donate: Click Donate
Cocos2d-x source Download: Dot I teleport
Games Official Download:HTTP://DWZ.CN/RWTJL
Game video preview:http://dwz.cn/RzHHd
Game Development Blog:Http://dwz.cn/RzJzI
Game Source Transfer : Http://dwz.cn/Nret1
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Translucent mask Background effects for iOS development [for drop-down menu pages and share pages]