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

后端 未结 6 898
臣服心动
臣服心动 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 05:04

    To fix invisible views with cornerRadius=height/2 create category UIView+LayoutFix

    In file UIView+LayoutFix.m add code:

    - (void)awakeFromNib {
        [super awakeFromNib];
        [self layoutIfNeeded];
    }
    

    add category to YourProject.PCH file.

    It will works only if you used [super awakeFromNib] in your views :

    MyView.m

    - (void)awakeFromNib {
        [super awakeFromNib];
        ...
    }
    

提交回复
热议问题