我想使用渐变作为我的UIView的背景。UIView突出显示背景渐变
CAGradientLayer *gradientLayer = [[CAGradientLayer alloc] init];
gradientLayer.frame = CGRectMake(0.f, 0.f, self.currencyView.frame.size.width, self.currencyView.frame.size.height);
[gradientLayer setLocations:@[@0.f, @1.f]];
[gradientLayer setColors:@[(id)[UIColor whiteColor].CGColor,(id)[UIColor blackColor].CGColor]];
[self.animalView.layer insertSublayer:gradientLayer atIndex:0];
我已经加入了UITapGestureRecognizer
UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showAnimalDetails)];
[self.currencyView addGestureRecognizer:singleFingerTap];
我的问题是由这种观点可点击,我怎么可以添加一个突出梯度(可能只是扭转了梯度)当触摸了检测。
任何帮助将不胜感激。
当您的视图被点击并设置为alpha时,更改一秒的alpha值.. :)可能会对您的情况有所帮助。 :) – iPatel