i am calling the data from xml in table view. after the the first row of data in tableview, my second row is empty in tableview, and from third row data is available. but my last data for row is missing from tableview, because of the second row. how can i fill that second row. this is my code:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] autorelease];
}
[[cell textLabel] setTextAlignment:UITextAlignmentLeft];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
Book *aBook= [appDelegate.books objectAtIndex:indexPath.row];
NSString *string1 =aBook.Latitude;
NSString *trimmedString = [string1 stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
double myDouble = [trimmedString doubleValue];
NSLog (@" this is the test of trim%f",myDouble);
NSString *string2=aBook.Longitude;
NSString *trimmedString1 = [string2 stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
double mDouble = [trimmedString1 doubleValue];
NSLog (@"this is the test result %f",mDouble);
if((((myDouble<(a+5.022))&&(myDouble>(a-10)))||((mDouble<=(b+10))&&(mDouble>=(b-10)))))
{
NSString *a1=aBook.AreaName;
NSString *b1=[a1 stringByAppendingString:@","];
NSString *s=aBook.STREET_NAME;
NSString *c=[b1 stringByAppendingString:s];
cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:15.0];
cell.textLabel.text = c;
cell.detailTextLabel.text=aBook.ActualCity;
//cellcount++;
NSLog (@"this is the test result %@ %f",aBook.STREET_NAME,myDouble);
}
return cell;
}
i am getting the row count 5 but value of the second row is sifted to the the third row and second row is empty , due to this last data for the row is missing.