layer is a part of cycle in its layer tree iOS 9 Swift 2

本秂侑毒 提交于 2019-12-05 01:28:18
exo_duz

I had the same error too and found this fix

It mentions to remove the accessoryView Outlet which you will see on the TableView.

To do this:

  1. Click on the Table View
  2. Go to the "Connections Inspector", it's the right window, the very last icon (looks like a circle with an arrow right)
  3. Look for the accessoryView and disconnect the outlet

In the screenshot below, see the outlet you are to disconnect:

check if you add self.view in self.view, exemple:

self.view.addSubview(view)

or

contentView.addSubview(self.view)

This might help someone still in trouble with this, For me the issue was this

layer.addSublayer(layer)

Adding a layer to itself 🤦‍♂️ . After this mistake I am planning to kill myself :(.

I solved one crash of this kind by removing the outlet to File' s owner in some of xib UI files. I answer here in case someone encounters a similar thing.

One of my friend was facing the same issue. The root cause was lying in the viewForHeaderInSection delegate of UITableview.

He was adding a label in main view of the controller in this delegate. He was supposed to create a UIView and return it in this delegate but unfortunately he was returning self.view there. So removing this code fixed the issue.

I've managed to fix it but not in the way that I'd hoped. I ended up scratching the tableViewCell that was causing the issue and rebuilding all the layout constraints from scratch. Not ideal, but it worked. I hope someone can come along in the future and explain why this error happened! Cheers.

I had this issue too, and found out I accidentally created an outlet from the TableViewCell backgroundView to the TableView's view - DOH!

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