我正在尝试遵循这些说明,但现在我被卡住了。
在您的视图控制器中:为 TKCalendarMonthView 添加一个出口。
@interface YourViewController () <TKCalendarMonthViewDataSource, TKCalendarMonthViewDelegate>
@property (weak, nonatomic) IBOutlet TKCalendarMonthView *calendarMonthView;
@end
在 -viewDidLoad 中,连接 TKCalendarMonthView 的委托和数据源。请注意,如果您首先将 IBOutlet 注释添加到 TKCalendarMonthView.h 中的委托和数据源属性,您也可以在 Storyboard 中执行此操作
@implementation YourViewController
...
- (void)viewDidLoad
{
[super viewDidLoad];
...
self.calendarMonthView.delegate = self;
self.calendarMonthView.dataSource = self;
我的项目中有这个代码,但是我运行它我得到了这个
#import "ViewController.h"
#import "TapkuLibrary.h"
#import "TKCalendarMonthView.h"
@interface ViewController () <TKCalendarMonthViewDataSource, TKCalendarMonthViewDelegate>
@property (weak, nonatomic) IBOutlet TKCalendarMonthView *calendarMonthView;
@end
@implementation ViewController Method
- (void)viewDidLoad {
[super viewDidLoad];
self.calendarMonthView.delegate = self;
self.calendarMonthView.dataSource = self;
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
它成功加载,但由于calendarMonthView:marksFromDate:toDate:'in 协议'TKCalendarMonthViewDataSource'未实现而停止
我想我的问题是如何在我的 viewDidLoad 中连接 TKCalendarMonthView 委托和数据源,因为那是我在说明中没有做的,因为我不知道怎么做,我认为这就是造成这种情况的原因。
谢谢你的时间!