简体   繁体   English

为什么我在XCode中收到过时的警告

[英]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.

相关问题 我在Xcode for iOS中得到了“枚举类型的隐式转换”警告,我不知道为什么 - I am getting an “Implicit conversion from enumeration type” warning in Xcode for iOS and I don't know why 为什么我从Xcode收到此警告? iOS代码似乎很好 - Why am I getting this warning from Xcode? The iOS code seems fine 为什么我在Xcode中遇到此Parse问题? - Why am I getting this Parse Issue in Xcode? 为什么我收到有关我的应用程序委托和CLLocationManageDelegate的警告? - Why am I getting this warning about my app delegate and CLLocationManageDelegate? 为什么在以下实例方法上收到“冲突类型”警告? - Why am I getting a “Conflicting types” warning on the below instance method? iOS:为什么我在Xcode中得到“未使用的变量”? - iOS : Why am I getting 'Unused variable' in Xcode? 如何覆盖Xcode中的弃用警告? - How to override deprecated warning in Xcode? 为什么我收到警告“找到名为“ center”的多个方法” - Why am I am getting the warning “Multiple methods named 'center' found” 为什么我不赞成使用“ shouldAutorotateToInterfaceOrientation:”警告 - Why don't i get a deprecated warning for “shouldAutorotateToInterfaceOrientation:” 使用不推荐的setStatusBarHidden方法时的Xcode警告 - Xcode warning when using deprecated setStatusBarHidden method
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM