I have got an history page, which is a UItableview with 5 rows. I have set the prototype cell to the specs i want, and added this text to the corresponding historyviewcontroller.h file:
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HistoryItem"];
return cell;
}
I am not seeing any cells when i run the app. I’ve clearly missed something, but i can’t quite see what.
You need to actually create the cells. dequeueReusableCellWithIdentifier only retrieves already created cells and does not create new ones.
Here’s how to do it: