“属性实现必须在接口中声明” iOS 中的错误
可能的重复:
目标 C:“属性实现必须在接口中声明”
我在另一个 viewController 中全局声明了一个 viewController 的对象。
我很确定
1-我已经导入了必要的 viewController 类
2-我已经在 .h 文件中为该对象添加了 @property(nonatomic, keep)
3-我已经合成了相同的对象。 m 文件
但我仍然收到错误消息,指出“属性实现必须在接口中声明”。我在这里做错了什么......我一直在这个问题上摸不着头脑......
.h 文件
#import "viewController1.h"
@interface viewController2 :UIViewController<UITableViewDelegate,UITableViewDataSource>{
viewController2 *vc2;
}
@property(nonatomic,retain)viewController2 *vc2;
-(void)someMethod;
@end
.m 文件
#import "viewController2.h"
@implementation viewController2
@synthesize vc2;
@end
Possible Duplicate:
Objective C: “Property implementation must have its declaration in interface”
I have a declared a object of a viewController globally in another viewController.
I am pretty sure that
1- i have imported the necessary viewController class
2 - i have witten the @property(nonatomic, retain) for that object in .h file
3 - i have synthesized the same object .m file
But still i am getting the error saying that “Property implementation must have its declaration in interface”. What am i doing wrong here.... i'v been scratching my head on this issue....
.h file
#import "viewController1.h"
@interface viewController2 :UIViewController<UITableViewDelegate,UITableViewDataSource>{
viewController2 *vc2;
}
@property(nonatomic,retain)viewController2 *vc2;
-(void)someMethod;
@end
.m file
#import "viewController2.h"
@implementation viewController2
@synthesize vc2;
@end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
@property(readwrite,retain)viewController2 *vc2;
。@property(readwrite,retain)viewController2 *vc2;
.像这样使用(使用@class指令)
并将其合成到.m文件中。
use like this (use @class directive)
and synthesize it in .m file.