как вставить 4query за один раз в sqlite в iphone - PullRequest
0 голосов
/ 28 июля 2011

Привет, друг, я пытаюсь дать приложение погоды по выборке парсером xml и отображать все значения в ячейке таблицы, но знаю, что хочу вставить данные в базу данных sqlite, но проблема в том, что только первый случай - вставка, другой случай не вставлен но я передаю запрос 4insert в своем операторе вставки sqlite, как увеличить значение этого переключателя на единицу для значения хранилища в таблице базы данных. Я записал этот код в методе делегата tableview 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;

1 Ответ

0 голосов
/ 28 июля 2011

Почему это не удовлетворяет другой случай? Вы всегда должны использовать регистр с indexpath.row, а во-вторых, это зависит от того, как вы вызываете этот метод?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...