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.
精彩评论