Want to populate two NSMutableArrays to 2 Custom Sections of tableView;
I have two NSMutableArrays with events and I want to split them to now and today sections.
For the first section:
I want to remove events from nowEvents Array and place them into my frist section.
EventClass *event = [appDelegate.nowEvents objectAtIndex:indexPath.row];
event.startTime is the start time of my event
event.endTime is the end time of my event
For 2nd section:
Remove the events that are happening now
EventClass *event = [appDelegate.todayEvents objectAtIndex:indexPath.row];
What I’d like to know is numberOfRowsInSection method, how it would look like and cellForRowAtIndexPath (here I’ve tried NSInteger section = [indexPath section]; if (section == 0) { } if (section == 1) {} – but what about if I won’t have an event that is happening now ?)
Something like this should work
If you don’t have an event happening now then your nowEvent array will be empty so in the numberOfRowsInSection will return 0 and therefore the cellForRowAtIndexPath won’t be called as there is nothing to display. Hope this helps.