私の質問は、配列の数が 4 より大きい場合、NSMutableArray
その名前にオブジェクトが含まれているということです。latLongArray
elementArray という名前の別の配列に 4 つおきのオブジェクトを追加し、4 つ未満の場合はすべてのオブジェクトを elementArray に追加し、NSLog のすべてのデータを出力します。
私はiPhone開発に不慣れです。ここに私のコードがあります
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
NSString *cellText = selectedCell.textLabel.text;
placeDC *placedc;
placedc = [dataArray objectAtIndex:[indexPath row]];
if ([txtFrom isFirstResponder]) {
txtFrom.text=cellText;
NSLog(@"%@",cellText);
originlat=placedc.latitude;
originlng=placedc.longitude;
NSLog(@"%@",placedc.countryFullName);
}
else
{
txtTo.text=cellText;
destinationLat=placedc.latitude;
DestinationLng=placedc.longitude;
DBHandler *db=[[DBHandler alloc]init];
NSLog(@"%@",placedc.countryFullName);
latLongArray=[db googlePlaces:originlat :originlng :destinationLat :DestinationLng];
if ([latLongArray count]>4) {
for (int i =0; i<=[latLongArray count]; i=i+4) {
}
NSLog(@"%d",[elentArray count]);
}
}
myTableView.hidden=YES;
[self.view endEditing:YES];
}