Is there a way to make gradient background color in the interface builder?

前端 未结 9 1171
终归单人心
终归单人心 2021-01-30 13:08

For my application I\'m using a TableView and using customized UITableViewCells.

I customized my cells via interface builder, not programmatically. Is there a way to als

9条回答
  •  余生分开走
    2021-01-30 13:41

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

提交回复
热议问题