0
#import "BGReviewController.h"

@interface BGReviewController (protected)
@property (weak, nonatomic) IBOutlet UIImageView *backgroundImage;
@property (weak, nonatomic) IBOutlet UIButton *dislikeButton;
@property (weak, nonatomic) IBOutlet UIButton *likeButton;
@property (weak, nonatomic) IBOutlet UIButton *post;
@property (weak, nonatomic) IBOutlet UIButton *cancel;
@property (weak, nonatomic) IBOutlet UITextView *textView;
@end

然后我补充说:

@synthesize backgroundImage = _backgroundImage;
@synthesize dislikeButton = _dislikeButton;
@synthesize likeButton = _likeButton;
@synthesize post = _post;
@synthesize cancel = _cancel;
@synthesize textView = _textView;

我得到了错误:/business/Dropbox/badgers/BadgerNew/BGReviewController.m:32:13:在“受保护”类别中声明的属性无法在类实现中实现

我应该在类别的实现文件中声明合成然后显式放置 ivars 吗?

4

2 回答 2

1

代替

@interface BGReviewController (protected)

@interface BGReviewController ()

于 2013-03-20T11:39:37.010 回答
1

你不能在一个类别中@synthesize,你必须手动做 getter 和 setter

看看这个答案

于 2013-03-20T11:34:37.027 回答