-(UIView *) returnGradientView {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = view.bounds;
//change your color as you like, I have used black and white
gradient.colors = @[(id)[UIColor blackColor].CGColor, (id)[UIColor whiteColor].CGColor];
[view.layer insertSublayer:gradient atIndex:0];
return view;
}
Edit
this will create an gradient view, upper side white and lower side is black. if you want to make top-bottom
or left-right
you have to add startPoint
and endPoint
just add two line
gradient.startPoint = CGPointMake(1.0, 0.0);
gradient.endPoint = CGPointMake(0.0, 0.0);
solved ios UIView for complete viewController frame [closed]