how to insert 4query at a time in sqlite in iphone
hi friend i try to give weather application by fetch by xml parser and all the value display in tableview cell but know i want to insert a data into sqlite database but the problem is that only first case is开发者_JAVA技巧 insert other case are not inserted but i pass 4insert query in my sqlite insert statement how to increment this switch case on by one for store value in database table i writen this code in tableview delegate method tableViewcellforRowAtIndexPath:
indexPath++;
switch (indexPath.row) {
case 0:
NSLog(@"%d",indexPath.row);
NSData *imageData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:currentcond.Icon]];
NSLog(@"this is image from server:%@",imageData);
cell.weatherimage.image = [UIImage imageNamed:photo];
[imageData release];
file://localhost/Users/pradeepyadav/Desktop/JourneyMapper/Journey/Classes/TJourneyTabBar.hcell.weatherimage.image = [UIImage imageNamed:photo];
cell.reportdate.text = _forecastInfo.CurrentDateTime;
//cell.conditionname.text = currentcond.Condition;
[cell setConditionName:currentcond.Condition];
//[cell setConditionName:cond1.Condition];
cell.twotemp.text = [NSString stringWithFormat:@"Temp:%@/%@",currentcond.Tempf,currentcond.Tempc];
cell.twodirection.text = currentcond.WindCondition;
cell.humidity.text = currentcond.Humidity;
break;
case 1:
NSLog(@"%d",indexPath.row);
cell.weatherimage.image = [UIImage imageNamed:photo];
cell.reportdate.text =[NSString stringWithFormat:@"%@",thursday];
//cell.conditionname.text = cond1.Condition;
[cell setConditionName:cond1.Condition];
cell.twotemp.text = [NSString stringWithFormat:@"Temp:%@/%@",cond1.Low,cond1.High];
break;
case 2:
NSLog(@"%d",indexPath.row);
cell.weatherimage.image = [UIImage imageNamed:photo];
cell.reportdate.text = [NSString stringWithFormat:@"%@",friday];
//cell.conditionname.text = cond2.Condition;
[cell setConditionName:cond2.Condition];
cell.twotemp.text = [NSString stringWithFormat:@"Temp:%@/%@",cond2.Low,cond2.High];
break;
case 3:
NSLog(@"%d",indexPath.row);
cell.weatherimage.image = [UIImage imageNamed:photo];
cell.reportdate.text = [NSString stringWithFormat:@"%@",sunday];
//cell.conditionname.text = cond3.Condition;
[cell setConditionName:cond3.Condition];
cell.twotemp.text = [NSString stringWithFormat:@"Temp:%@/%@",cond3.Low,cond3.High];
break;
default:
NSLog(@"Out of Range ",indexPath.row);
break;
}
return cell;
Why its not satisfying the other case? you should always use the case with indexpath.row and the second thing is, it depends how you are calling this method ?
精彩评论