Using gradient from one color ro another
1 2 3 4 5 6 |
UIView* v = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 50.0f)]; CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = v.bounds; gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor] CGColor], (id)[[UIColor blackColor] CGColor], nil]; [v.layer insertSublayer:gradient atIndex:0]; |
Using a sliver of gradient as background
1 |
weatherView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:gradientImageName]]; |