iOS 10 GM with xcode 8 GM causes views to disappear due to roundedCorners & clipsToBounds

后端 未结 6 891
臣服心动
臣服心动 2020-12-03 04:23

I tested my app with iOS 10 Beta 7 and Xcode 8 beta and everything worked fine. However just a few minutes ago I installed the now available GM releases of both and faced a

6条回答
  •  死守一世寂寞
    2020-12-03 04:58

    I am not sure if this is a new requirement, but I solved this by adding [self layoutIfNeeded]; before doing any cornerRadius stuff. So my new custom awakeFromNib looks like this:

    - (void)awakeFromNib {
        [super awakeFromNib];
        [self layoutIfNeeded];
        self.tag2label.layer.cornerRadius=self.tag2label.frame.size.height/2;
        self.tag2label.clipsToBounds=YES;
    }
    

    Now they all appear fine.

提交回复
热议问题