开发者

how to set tableViewCell background to black gradient like navigationbar

I have set up my own custom tableViewCell and want to the background to be the same black gradient as my navigationBar with style UI开发者_开发技巧BarStyleBlackOpaque.

what would be the best way to do that ?


Use the key combination CMD-SHIFT-4 to capture a 1 pixel wide image of the navigation bar's gradient. The image will be saved on your desktop (you can use Preview to crop, etc.). Add the image to your project. In -tableView:cellForRowAtIndexPath:, use:

cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"blackGradient.png"]];

UIKit automatically stretches the gradient horizontally to fit the width of the cell.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜