调查后Custom UITableViewCell backgroundView & selectedBackgroundView ,我注意到每层 backgroundView
和 selectedBackgroundView
(分组 TableView 的每个单元格)都有一个 CGImageRef
作为其内容。
Apple 必须创建每个 CGImageRef
并显式设置每个层的内容吗?
最佳答案
是的,UIGroupTableViewCellBackground
是其图层的委托(delegate),并在 displayLayer:
中设置其图层的内容
。我通过使用 setContents:
方法创建 MyLayer : CALayer
来解决这个问题,在该方法中放置一个断点,并实现 +[UIGroupTableViewCellBackground layerClass]
返回[MyLayer 类]
。然后,我检查了断点被击中时的回溯。
关于iphone - CALayer 是否导出其内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9337901/