简体   繁体   English

UIColor的CGColor访问器是属性还是方法?

[英]Is UIColor's CGColor accessor a property or method?

I found a curious bit of code near the bottom of UIColor.h (lines 69-71 in my SDK): 我在UIColor.h的底部附近发现了一些奇怪的代码(我的SDK中的69-71行):

// Access the underlying CGColor or CIColor.
@property(nonatomic,readonly) CGColorRef CGColor;
- (CGColorRef)CGColor NS_RETURNS_INNER_POINTER CF_RETURNS_NOT_RETAINED;

Why is CGColor defined as both a property and a method? 为什么将CGColor定义为属性和方法? Is it truly a property but just defined as a method so they use the two annotations? 它是真正的属性,只是被定义为方法,以便它们使用两个注释吗?

该方法是属性的综合getter方法,需要声明该方法才能分配返回注释

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM