@property(只读,保留)有意义吗? [英] Does @property (readonly, retain) have a meaning?

查看:74
本文介绍了@property(只读,保留)有意义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XCode 接受它.但是当我内部设置属性时会应用保留(因为只读,但当我在类方法中初始化值时没有设置器在外面)?

XCode accepts it. But will retain be applied when I internally set the property (no setter outside since readonly but when I initialize the value in a class method) ?

问候,苹果92

推荐答案

这样做的原因是让您可以在类延续或类别中执行 @property (retain).如果您在外部属性上没有保留,您将收到有关属性不匹配的警告.

The reason to do this is to allow you to do @property (retain) in a class continuation or category. If you don't have the retain on the outer property, you will get a warning about the properties being mismatched.

这篇关于@property(只读,保留)有意义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆