Swift UIViewReportBrokenSuperviewChain cause by Layer manipulation

后端 未结 1 1915
轮回少年
轮回少年 2021-01-02 01:54

I run into a problem after migrating my code to Swift 3. I guess iOS10 raises new issues now and it\'s actually not related to Swift itself.

The error:



        
相关标签:
1条回答
  • 2021-01-02 02:35

    I had this issue with a library when moving over to Xcode 8 (Material-Controls-For-iOS - MDTextField). I found that the problem was coming from where the layer of one view (which had no superview) was being added to another.

    It looks like this may be the case for yourself also - your toolbar being created has not been added to a superview first. The fix I used was to add the view as a subview of the view that the layer was being added to, so in your case adding the toolbar as a subview of myModelView should stop the error.

    0 讨论(0)
提交回复
热议问题