How to connect delegate and data source?

115 Views Asked by At

I am trying to follow these instructions but now I am stuck.

In your view controller: Add an outlet for the TKCalendarMonthView.

@interface YourViewController () <TKCalendarMonthViewDataSource, TKCalendarMonthViewDelegate>
@property (weak, nonatomic) IBOutlet TKCalendarMonthView *calendarMonthView;
@end

In -viewDidLoad, connect TKCalendarMonthView's delegate and data source. Note, you can also do this in the Storyboard if you first add the IBOutlet annotate to the delegate and dataSource properties in TKCalendarMonthView.h

@implementation YourViewController
...
- (void)viewDidLoad
{
[super viewDidLoad];
...
self.calendarMonthView.delegate = self;
self.calendarMonthView.dataSource = self;

I have this code in my project but overtime I run it I get this

#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

It successfully loads but then stops because of calendarMonthView:marksFromDate:toDate:'in protocol 'TKCalendarMonthViewDataSource' not implemented

I guess my question is how do I connect TKCalendarMonthView delegate and data source in my viewDidLoad because thats what I didn't do in the instructions since I don't know how and I think that's what's causing this.

Thanks for your time!

2

There are 2 best solutions below

0
Fahim Parkar On

READ IT AGAIN, it says not implemented.

That means, you need to implement calendarMonthView:marksFromDate:toDate: in your code...

Regarding delegate, you have already done by use of below statements in viewDidLoad.

self.calendarMonthView.delegate = self;
self.calendarMonthView.dataSource = self;
0
nitin.agam On

You need to implement this method "calendarMonthView:marksFromDate:toDate" of DataSource protocol