在我的AppDelegate.h文件中,我编写了以下代码
@interface iBountyHunterAppDelegate : NSObject <UIApplicationDelegate> {
UITabBarController *tabcontroller;
}
@property (nonatomic,retain) IBOutlet UITabBarController *tabcontroller;在AppDelegate.h文件中,我合成了它。
@synthesize tabcontroller;但在@synthesize行中,我得到一个错误,消息是:“缺少属性实现声明的上下文”。
有谁能告诉我怎么解决这个问题吗?
发布于 2011-08-08 18:24:53
我怀疑你把@synthesize放在了你的@实现之外。它应该看起来像这样
// iBountyHunterAppDelegate.m
#import "iBountyHunterAppDelegate.h"
@implementation iBountyHunterAppDelegate
@synthesize tabcontroller; // note that this is between @implementation and @end
// other stuff
@end发布于 2011-08-08 17:58:16
“然后在AppDelegate.h文件中合成它。”可能只是拼写错误,但它必须在.m文件中:P
发布于 2011-08-12 19:23:51
@interface iBountyHunterAppDelegate : NSObject <UIApplicationDelegate>
{
UITabBarController IBOutlet *tabcontroller;
}
@property (nonatomic,retain) IBOutlet UITabBarController *tabcontroller;在AppDelegate.h文件中,我将其合成。
@synthesize tabcontroller;https://stackoverflow.com/questions/6980378
复制相似问题