首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:@synthesize

错误:@synthesize
EN

Stack Overflow用户
提问于 2011-08-08 17:53:23
回答 4查看 897关注 0票数 4

在我的AppDelegate.h文件中,我编写了以下代码

代码语言:javascript
复制
@interface iBountyHunterAppDelegate : NSObject <UIApplicationDelegate> {
    UITabBarController *tabcontroller;

}
@property (nonatomic,retain) IBOutlet UITabBarController *tabcontroller;

在AppDelegate.h文件中,我合成了它。

代码语言:javascript
复制
@synthesize tabcontroller;

但在@synthesize行中,我得到一个错误,消息是:“缺少属性实现声明的上下文”。

有谁能告诉我怎么解决这个问题吗?

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2011-08-08 18:24:53

我怀疑你把@synthesize放在了你的@实现之外。它应该看起来像这样

代码语言:javascript
复制
//  iBountyHunterAppDelegate.m

#import "iBountyHunterAppDelegate.h"

@implementation iBountyHunterAppDelegate

@synthesize tabcontroller; // note that this is between @implementation and @end

// other stuff

@end
票数 6
EN

Stack Overflow用户

发布于 2011-08-08 17:58:16

“然后在AppDelegate.h文件中合成它。”可能只是拼写错误,但它必须在.m文件中:P

票数 5
EN

Stack Overflow用户

发布于 2011-08-12 19:23:51

代码语言:javascript
复制
@interface iBountyHunterAppDelegate : NSObject <UIApplicationDelegate> 

{

    UITabBarController IBOutlet *tabcontroller;

}

@property (nonatomic,retain) IBOutlet UITabBarController *tabcontroller;

AppDelegate.h文件中,我将其合成。

代码语言:javascript
复制
@synthesize tabcontroller;
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6980378

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档