Hi all,
After we add the Protocol to the .h file we need to implement - in the .m file - the 3 methods that are required. One of them is [color=#00BFFF] numberOfRowsInTableView:[/color].
If tasks has not been created yet then [self.tasks count] should return an error (is this right?). Therefore I believe one should check this first.
Hence, my question is: why don’t we make the code as following?
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
{
//this table-view shows the array of activities, hence the number of elements in the table = the number of elements in the array (= [self.tasks count])
NSInteger numberOfRows = 0;
if (self.tasks){
numberOfRows = [self.tasks count];
}
return numberOfRows;
}