[英]Why am I getting a deprecated warning in XCode
I am getting a warning about setText method when I am not even using it. 当我什至不使用setText方法时,我会收到一条警告。 Why does XCode display this warning message?
XCode为什么显示此警告消息?
alt text http://www.angryhacker.com/toys/deprecated.jpg 替代文字http://www.angryhacker.com/toys/deprecated.jpg
The cell.text
property is deprecated in iPhone OS 3.0 and greater, because new table cell types allow multiple labels. 在iPhone OS 3.0及更高版本中,不推荐使用
cell.text
属性,因为新的表格单元格类型允许多个标签。 Instead, use cell.textLabel.text
to accomplish the same thing. 而是使用
cell.textLabel.text
完成相同的操作。
this is how properties work 属性就是这样工作的
x = object.field
is (by default) the same as calling x = [object field]
x = object.field
(默认情况下)与调用x = [object field]
and object.field = x
is (by default) the same as calling [object setField:x]
和
object.field = x
(默认情况下)与调用[object setField:x]
The up two answers are more than correct. 前两个答案不仅仅正确。 Just to add some references from Apple's Dev.
只是添加一些来自Apple开发人员的参考。 Believe that will solve all of your questions.
相信这将解决您的所有问题。 Please take a look at the session for " Object Messaging "
请看一下“ 对象消息传递 ”的会议
通过按原样设置类的字段,实际上是在调用setText方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.