问题
I had a rounded UIButton in a custom table view cell initialized via a XIB
, and it was working fine. I just noticed that the border, a circular pink border, now doesn't appear. I tried adding some code to also set the property in the awakeFromNib
function, but this also didn't do the trick.
- (void)awakeFromNib {
[super awakeFromNib];
[self setupProfileView];
self.contentView.backgroundColor = [UIColor colorWithWhite:0.97f alpha:1.0f];
self.selectionStyle = UITableViewCellSelectionStyleNone;
_initialLabel.layer.cornerRadius = _initialLabel.frame.size.width/2;
_initialLabel.layer.borderWidth = 2;
_initialLabel.layer.borderColor = [UIColor colorWithRed:223.0/255.0 green:158.0/255.0 blue:255.0/255.0 alpha:1].CGColor;
NSLog(@"on profile table view cell border width is %f and radius is %f and color is %@", _initialLabel.layer.cornerRadius, _initialLabel.layer.borderWidth, _initialLabel.layer.borderColor);
}
The above prints out what I would expect (the correct color + radius + width), but it doesn't show in the view. It's the only reference in code to _initialLabel
, so it's not getting set somewhere else in code.
Has anyone run into this and know a fix? Any ideas how to troubleshoot this further?
来源:https://stackoverflow.com/questions/38405156/rounded-border-on-uibutton-has-disappeared