UITableView Cell需要再次单击才能显示正确的数据

时间:2013-01-25 20:44:14

标签: ios uitableview cell

我有一个数组是我的UITableView的内容,我创建了一个segue以模态形式显示单击单元格的详细信息,但我需要再次单击它才能显示正确的数据。我使用indexpath.row作为我的引用来获取当前行,但它不起作用

我的viewdidload部分

if([form.formDefinitionID isEqualToString:@" xxx"])             {

            NSMutableDictionary *jsonObject=[[NSMutableDictionary alloc]init];
             NSData *jsonData=[NSData dataFromBase64StringUsingASCIIEncoding:form.body];
            jsonObject=[NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:nil];
            if ([NSJSONSerialization isValidJSONObject:jsonObject])
                {

                    [stopTitle addObject:[jsonObject valueForKey:@"Customer"]];
                    [origin addObject:[jsonObject valueForKey:@"Origin"]];


                }

        }


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        lcustomer=[stopTitle objectAtIndex:indexPath.row];
        lorigin =[originArray objectAtIndex:indexPath.row];
       [self performSegueWithIdentifier:@"shuttleDetails" sender:self];

}

 if ([segue.identifier isEqualToString:@"shuttleDetails"]) {

        ShuttleRegistration *sr=segue.destinationViewController;
        sr.smgt=self;

        sr.strTitle=@"Shuttle/Trip Details";
        sr.strCustomer=lcustomer;
        sr.strOrigin=lorigin;

在我的模态视图viewdidload上,我使用strCustomer和strOrigin分别设置文本域文本

0 个答案:

没有答案
相关问题