search

Home  >  Q&A  >  body text

objective-c - 为什么borderColor要使用CGColor而不能使用UIColor

我在别的地方看到这样一句话
CALayer sits at a lower technical level than UIButton, which means it doesn't understand what a UIColor is. UIButton knows what a UIColor is because they are both at the same technical level, but CALayer is below UIButton, so UIColor is a mystery.

高洛峰高洛峰2879 days ago630

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-05-02 09:21:51

    CGColor exists in the lower-level CoreGraphics framework, it is a structure
    UIColor exists in the UIKit framework, which is higher than the CoreGraphics framework, and it is a class

    CoreGraphics framework can be used across platforms, while UIKit framework is limited to iOS
    In order to ensure portability and unity of the framework, they cannot be used interoperably

    reply
    0
  • Cancelreply