Rounded border on UIButton has disappeared

雨燕双飞 提交于 2019-12-25 13:40:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!