我有一个视图和一个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
答案 0 :(得分:2)
问题是您在PlusCalendarView
和ViewController.h
中声明PlusCalendarView.h
。您应该从@interface
删除ViewController.h
声明。
相反,在@class PlusCalendarView
中添加ViewController.h
,然后在#import "PlusCalendarView.h"
ViewController.m