實(shí)現(xiàn)可視化的各種手勢(shì)操作
作者:佚名
實(shí)現(xiàn)可視化的各種手勢(shì)操作,也就是給手勢(shì)操作添加軌跡效果,包括點(diǎn)擊、滑動(dòng)、長(zhǎng)按等等。
源碼簡(jiǎn)介
實(shí)現(xiàn)可視化的各種手勢(shì)操作,也就是給手勢(shì)操作添加軌跡效果,包括點(diǎn)擊、滑動(dòng)、長(zhǎng)按等等。
源碼運(yùn)行截圖
代碼片段
- _- (COSTouchVisualizerWindow *)window
- {
- static COSTouchVisualizerWindow *customWindow = nil;
- if (!customWindow) {
- customWindow = [[COSTouchVisualizerWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- [customWindow setFillColor:[UIColor yellowColor]];
- [customWindow setStrokeColor:[UIColor purpleColor]];
- [customWindow setTouchAlpha:0.4];
- [customWindow setRippleFillColor:[UIColor yellowColor]];
- [customWindow setRippleStrokeColor:[UIColor purpleColor]];
- [customWindow setRippleAlpha:0.1];
- }
- return customWindow;
- }
- - (void)COSTouchVisualizerWindow_commonInit {
- self.strokeColor = [UIColor blackColor];
- self.fillColor = [UIColor whiteColor];
- self.rippleStrokeColor = [UIColor whiteColor];
- self.rippleFillColor = [UIColor blueColor];
- self.touchAlpha = 0.5;
- self.fadeDuration = 0.3;
- self.rippleAlpha = 0.2;
- self.rippleFadeDuration = 0.2;
- self.stationaryMorphEnabled = YES;
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(screenConnect:)
- name:UIScreenDidConnectNotification
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(screenDisconnect:)
- name:UIScreenDidDisconnectNotification
- object:nil];
- // Set up active now, in case the screen was present before the window was created (or application launched).
- [self updateFingertipsAreActive];
- }
責(zé)任編輯:chenqingxiang
來(lái)源:
網(wǎng)絡(luò)整理