

I have created UITableViewController. I have a NSMutableArray with three records. I have created a custom UITableViewCell class and linked it with TableViewCell. But when running the program my tableview displays below output. There are only three records but table view shows 5 rows and all my data are showed in first row itself.
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
callRecordsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CallRecordsCell" forIndexPath:indexPath];
callRecords *record = [self.callRecordsDataController callRecordAtIndex:indexPath.row];
NSLog(@"Indexpath row now is %d",indexPath.row);
cell.callRecordOriginalDestinationLabel.text = record.originalDestination_Alias;
NSDateFormatter *df = [[NSDateFormatter alloc]init];
[df setDateFormat:@"dd-MMM"];
cell.callRecordStartTime.text = [[NSString alloc]initWithString:[df stringFromDate:record.start_Time]];
cell.callRecordCallDuration.text = record.call_Duration;
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
NSLog(@"count is %d",[self.callRecordsDataController callRecordsCount]);
return [self.callRecordsDataController callRecordsCount];
}
DataController code
-(NSUInteger)callRecordsCount{
return [self.callRecordsList count];
}
- (callRecords *)callRecordAtIndex:(NSUInteger)index{
return [self.callRecordsList objectAtIndex:index];
}
I found the problem.it was because of rendering issues in iphone7plus simulator.i ran the same project in other simulators it was displaying it correctly.
!iphone7plus simulator

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With