0

Web サービスからデータをフェッチしています。

//temp1 is NSDictionary
//responseArr1 is NSMutableArray
for(temp1 in responseArr1)......., 
{
     quesTxt = [[temp1 objectForKey:@"question_text"] stringByReplacingOccurrencesOfString:@"%PROFILENAME%" withString:del.onlyFirstName];

     quesID = [temp1 objectForKey:@"idlife_stage_question"];

     Home *objHome=[[Home alloc] init];

     objHome.homeQuesTxt = quesTxt;
     objHome.homeQuesID = quesID;

     [quesArray addObject:objHome];

     //[quesArray addObject:[[temp1 objectForKey:@"question_text"] stringByReplacingOccurrencesOfString:@"%PROFILENAME%" withString:del.onlyFirstName]];//this works fine

        }

ピッカービューに入力しようとすると、すべての日付で例外が発生します。

ピッカー ビュー デリゲート:

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
    UILabel *retval = (id)view;
    if (!retval) {
        retval= [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [pickerView rowSizeForComponent:component].width, [pickerView rowSizeForComponent:component].height)];
    }

    retval.text = [quesArray objectAtIndex:row];.........// **EXCEPTION HERE**...

    retval.font = [UIFont boldSystemFontOfSize:14];
    retval.numberOfLines = 3;

    return retval;
}

私のWebサービスのサンプル:

{
        "idlife_stage_question" = 35;
        "life_stage_idlife_stage" = 1;
        "profile_idprofile" = 0;
        "question_text" = "When %PROFILENAME% first smiled?";..//%PROFILENAME% replaces with user name which i have
        sequence = 34;
    }

Home は NSObject のサブクラスです

助けてください。

4

3 に答える 3

0

にオブジェクトquesArrayが取り込まれますHome

Home *home = quesArray[row];
retval.text = home.homeQuesTxt;
于 2013-04-23T11:03:26.197 に答える