找不到属性虽然它在标题中

时间:2014-10-27 00:00:48

标签: ios objective-c

我有一个视图和一个View Controller。我试图从视图中引用View Controller。

PlusCalendarView.h

@interface PlusCalendarView : TSQCalendarView

    @property (nonatomic, strong) UIViewController *initialVC;

@end

ViewController.m

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpCalendarView:self.myCalendarView];

    self.myCalendarView.initialVC = self; // ERROR: Property initialVC not found on object of type "PlusCalendarView"
}

为什么找不到initialVC属性?

更新

ViewController.h

#import <UIKit/UIKit.h>
#import <TimesSquare/TimesSquare.h>

@interface PlusCalendarView : TSQCalendarView;

@end

@interface ViewController : UIViewController

@property (nonatomic, strong) NSCalendar *calendar;
@property (strong, nonatomic) IBOutlet PlusCalendarView *myCalendarView;

@end

1 个答案:

答案 0 :(得分:2)

问题是您在PlusCalendarViewViewController.h中声明PlusCalendarView.h。您应该从@interface删除ViewController.h声明。

相反,在@class PlusCalendarView中添加ViewController.h,然后在#import "PlusCalendarView.h"

中添加ViewController.m