what's the code to put a border around a UITableViewCell's contentView? (for testing)
If not possible why is this? (for my learning)
Have you tried using contentView
's underlying CALayer
? Try something like this:
#import <QuartzCore/QuartzCore.h>
- (void)someAppropriateMethod
{
[self.myTableViewCell.contentView.layer setBorderColor:[UIColor redColor].CGColor];
[self.myTableViewCell.contentView.layer setBorderWidth:1.0f];
}
You could also apply it to the cells contentView loke so:
#import <QuartzCore/QuartzCore.h>
- (void)someAppropriateMethod {
myTableViewCell.contentView.layer.borderColor = [[UIColor redColor] CGColor];
myTableViewCell.contentView.layer.borderWidth = 1;
}
Swift 4:
myTableViewCell.contentView.layer.borderColor = UIColor.black.cgColor
myTableViewCell.contentView.layer.borderWidth = 1.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With