0

嗨,朋友,我的应用程序在单击单元格时崩溃,因为我在这一行 rowToSelect=indexPath;. 但我需要这一行当我单击 section1 ==row==0 时,我必须传递在 cellbackground 图像上选择的图像的所有行然后我得到这个错误

'-[__NSArrayM row]: unrecognized selector sent to instance 0x4c7080' * First throw call stack: (0x37e378bf 0x379831e5 0x37e3aacb 0x37e39945 0x37d94680 0x319921e9 0x319921af 0x5b47 0x3193f9cb 0x3193eaa9 0x3193e233 0x318e2d29 0x37d9622b 0x37430381 0x3742ff99 0x3743411b 0x37433e57 0x3742bd85 0x37e0bb4b 0x37e09d87 0x37e0a0e1 0x37d8d4dd 0x37d8d3a5 0x37b64fcd 0x3190d743 0x2927 0x28dc) terminate调用抛出异常程序收到信号:“SIGABRT”。数据格式化程序暂时不可用,将在“继续”后重试。(找不到 dlopen 函数,所以无法加载共享库。)

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {


    rowToSelect=indexPath;//when i remove this line then my application is not crashing but when i keep

     this line the i click section1 and row0 then application is crash why this happen where i am wong please help me



        UIViewController <SubstitutableDetailViewController> *detailViewController = nil;

        if ([indexPath row] == 0 && [indexPath section] == 0) {
            TodoDetailViewController *newDetailViewController = [[TodoDetailViewController alloc] initWithNibName:@"TodoDetailViewController" bundle:nil];
            detailViewController = newDetailViewController;


        }

        if ([indexPath row] == 0 && [indexPath section] == 1){
            PeopleViewController *newDetailViewController = [[PeopleViewController alloc] initWithNibName:@"PeopleViewController" bundle:nil];

            detailViewController = newDetailViewController;

        }

         if ([indexPath row] == 1 && [indexPath section] == 1){
            DocumentsViewController *newDetailViewController = [[DocumentsViewController alloc] initWithNibName:@"DocumentsViewController" bundle:nil];
            detailViewController = newDetailViewController;
        }

         if ([indexPath row] == 2 && [indexPath section] == 1){
            PlannerViewController *newDetailViewController = [[PlannerViewController alloc] initWithNibName:@"PlannerViewController" bundle:nil];
            detailViewController = newDetailViewController;
        }



         if ([indexPath row] == 0 && [indexPath section] == 2){
            ArchivedPeopleViewController *newDetailViewController = [[ArchivedPeopleViewController alloc] initWithNibName:@"ArchivedPeopleViewController" bundle:nil];
            detailViewController = newDetailViewController;
        }




        // Update the split view controller's view controllers array.
       NSArray *viewControllers = [[NSArray alloc] initWithObjects:self.navigationController, detailViewController, nil];
        splitViewController.viewControllers = viewControllers;


        if (popoverController !=nil) 
        {
            [popoverController dismissPopoverAnimated:YES];
        }
       .
        if (rootPopoverButtonItem != nil) {
            [detailViewController showRootPopoverButtonItem:self.rootPopoverButtonItem];
        }
        [detailViewController release];

    }
4

1 回答 1

0

使它成为

rowToSelect=indexPath.row;
于 2012-07-11T05:53:49.237 回答