在我viewDidLoad中正确设置我打电话方法:CAGradient层向上移动在iPhone 6S加,而在iPhone 5
[self applyGradientOnDogImageView];
-(void)applyGradientOnDogImageView{
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = CGRectMake(self.dogImageView.bounds.origin.x, self.dogImageView.bounds.origin.y+self.dogImageView.bounds.size.height/2, self.dogImageView.bounds.size.width, self.dogImageView.bounds.size.height/2);
gradient.colors = [NSArray arrayWithObjects:(__bridge id)[[UIColor clearColor] CGColor], (__bridge id)[[[UIColor blackColor] colorWithAlphaComponent:1.0] CGColor], nil];
[self.dogImageView.layer insertSublayer:gradient atIndex:0];
}
在iphone 5我得到这样的输出:
如何解决这个梯度在iPhone 6s plus向上移动的问题?
这是一个有趣的狗! :) –
@邓肯和名称是老虎;) – crypt
你使用imageview的autolayout?你正在展示的功能何时被调用? – Maurice