xcode: 属性'标题' “复制”属性与超类“UIViewController”不匹配财产
您好,我目前收到此错误消息。由于对香蕉的热爱,我无法弄清楚我做错了什么。
它只是一个
IBOutlet UILabel *title;
连接
@property(nonatomic, retain) IBOutlet UILabel *title;
到我的 xib 文件的连接到 UILabel 的连接,因为我在运行时动态更改标题。
Classes/../taskViewController.h:44: warning: property 'title' 'copy' attribute does not match super class 'UIViewController' property
我不明白这意味着什么。 通常我能够摆脱警告消息。但这一个……我不知道发生了什么事。
有人可以指导我并解释这里发生的事情吗?
Hi I'm currently getting this error message. and by the love of banana, I cannot figure out what I am not doing right.
Its just an
IBOutlet UILabel *title;
and
@property(nonatomic, retain) IBOutlet UILabel *title;
I've made which is connected to my xib file connected to a UILabel because I dynamically change the title during run time.
Classes/../taskViewController.h:44: warning: property 'title' 'copy' attribute does not match super class 'UIViewController' property
I dont understand what it means.
Normally i am able to get rid of warning messages. But this one... I dont have a clue whats going on.
Can someone please guide me and explain what is happening here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的问题是 UIViewController 已经定义了一个 title 属性,并且您正在使用与它不同的内存管理选项。要解决此问题,请更改您的财产的名称。例如:
@property(非原子,复制)UILabel *titleLabel;
。如果您希望实例变量具有相同的名称,并且使用@synthesize,请使用@synthesize titleLabel=title;
。顺便说一句,你为什么要复制 UILabel?通常您会使用retain,以便它是同一个对象。
Your problem is that UIViewController already defines a title property and you are using a different memory manangement option than it does. To fix this, change the name of your property. ex:
@property (nonatomic, copy) UILabel *titleLabel;
. If you want the instance variable to have the same name, and you use @synthesize, use@synthesize titleLabel=title;
.As an aside, why are you copying a UILabel? Normally you would use retain so that it is the same object.
这意味着:
It means:
好吧,我想澄清一下,标题是 UIViewController 中的预定义对象,因此您无法创建具有相同名称的自己的对象,用其他东西更改它并查看它不会给您该错误。
Well i want to just clarify that title is a predefined object in the UIViewController so you cannot create your own objects with that same name, change the with some thing else and see that it wont give you that error.