IPhone : UiView Gradient incorrectly positioned

on Saturday, February 21, 2015

II have a UIView within my viewController. When i set a background colour to the view everything displays in the correct place. But i am trying to add a gradient to the background of the UIView using



CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = self.gradientView.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor] CGColor], color.CGColor, nil];
[self.gradientView.layer insertSublayer:gradient atIndex:0];


The gradient displays nicely but not to the bounds of the UIView (it starts lower down the page than the UIView). Any ideas?


0 comments:

Post a Comment