我正在从 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;
}
我的网络服务示例:
{
"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 的子类
请帮忙。