【问题标题】:Does CALayer derive its contents?CALayer 是否派生出它的内容?
【发布时间】:2012-02-18 02:09:18
【问题描述】:

在调查Custom UITableViewCell backgroundView & selectedBackgroundView 之后,我注意到backgroundViewselectedBackgroundView 的每一层(分组表视图的每个单元格)都有一个CGImageRef 作为其内容。

Apple 必须创建每个 CGImageRef 并明确设置每个层的内容吗?

【问题讨论】:

  • 这是一个实现细节。为什么它对你很重要?你有什么问题?

标签: iphone cocoa-touch core-animation calayer


【解决方案1】:

是的,UIGroupTableViewCellBackground 是其层的委托,并将其层的 contents 设置为 displayLayer:。我通过使用setContents: 方法创建MyLayer : CALayer 来解决这个问题,我在其中放置了一个断点,并实现+[UIGroupTableViewCellBackground layerClass] 以返回[MyLayer class]。然后,当断点被命中时,我检查了回溯。

【讨论】:

    猜你喜欢
    • 2020-05-21
    • 1970-01-01
    • 2021-10-22
    • 2019-05-20
    • 1970-01-01
    • 2012-12-23
    • 2012-04-21
    • 2011-02-01
    • 2011-12-08
    相关资源
    最近更新 更多