2009-09-23 3 views
0

Je crée une application iPhone qui affiche un UITableView au début avec du texte dans les cellules. Lorsqu'un utilisateur appuie sur une cellule, elle doit passer à une autre vue. Quand je lance l'application sur l'iPhone Simulator et cliquez sur une cellule que je reçois l'erreur suivante:NSInvalidArgumentException

2009-09-23 12:20:03.554 ZDFMobiel[751:20b] *** Terminating app due to uncaught exception 
'NSInvalidArgumentException', reason: '*** -[RootViewController eigenRisicoView]:  
unrecognized selector sent to instance 0xd1d1a0' 
2009-09-23 12:20:03.555 ZDFMobiel[751:20b] Stack: (

Voici la fonction (Dans RootViewController.m) où l'erreur est survenue. Cela se produit à la ligne ou à l'autre if, en fonction de la cellule sur laquelle vous cliquez.

if(self.eigenRisicoView == nil) { 

// Override to support row selection in the table view. 
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

ZDFMobielAppDelegate *appDelegate = (ZDFMobielAppDelegate *)[[UIApplication sharedApplication] delegate]; 
NSString *content = (NSString *)[appDelegate.menuItems objectAtIndex:indexPath.row]; 

switch (indexPath.row) { 
    case 0: 
    if(self.eigenRisicoView == nil) { 
    EigenRisicoViewController *viewController = [[EigenRisicoViewController alloc] initWithNibName:@"EigenRisicoViewController" bundle:[NSBundle mainBundle]]; 
    self.eigenRisicoView = viewController; 
    [viewController release]; 
    } 
    [self.navigationController pushViewController:self.eigenRisicoView animated:YES]; 
    self.eigenRisicoView.title = content; 

    break; 

    case 1: 
    if(self.declaratieStatusView == nil) { 
    DeclaratieStatusViewController *viewController = [[DeclaratieStatusViewController alloc] initWithNibName:@"DeclaratieStatusViewController" bundle:[NSBundle mainBundle]]; 
    self.declaratieStatusView = viewController; 
    [viewController release]; 
    } 
    [self.navigationController pushViewController:self.declaratieStatusView animated:YES]; 
    self.declaratieStatusView.title = content; 

    break; 

    case 2: 
    if(self.vergoedingenView == nil) { 
    VergoedingenViewController *viewController = [[VergoedingenViewController alloc] initWithNibName:@"VergoedingenViewController" bundle:[NSBundle mainBundle]]; 
    self.vergoedingenView = viewController; 
    [viewController release]; 
    } 
    [self.navigationController pushViewController:self.vergoedingenView animated:YES]; 
    self.vergoedingenView.title = content; 

    break; 

    case 3: 
    if(self.zoekenZorgInstView == nil) { 
    ZoekenZorgInstViewController *viewController = [[ZoekenZorgInstViewController alloc] initWithNibName:@"ZoekenZorgInstViewController" bundle:[NSBundle mainBundle]]; 
    self.zoekenZorgInstView = viewController; 
    [viewController release]; 
    } 
    [self.navigationController pushViewController:self.zoekenZorgInstView animated:YES]; 
    self.zoekenZorgInstView.title = content; 

    break; 
    default: 
    break; 
} 


    // Navigation logic may go here -- for example, create and push another view controller. 
// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; 
// [self.navigationController pushViewController:anotherViewController animated:YES]; 
// [anotherViewController release]; 
    } 

Ceci est mon fichier RootControllerView.h

#import "EigenRisicoViewController.h"; 
#import "DeclaratieStatusViewController.h"; 
#import "VergoedingenViewController.h"; 
#import "ZoekenZorgInstViewController.h"; 
#import "ZDFMobielAppDelegate.h"; 

@interface RootViewController : UITableViewController { 
EigenRisicoViewController *eigenRisicoView; 
DeclaratieStatusViewController *declaratieStatusView; 
VergoedingenViewController *vergoedingenView; 
ZoekenZorgInstViewController *zoekenZorgInstView; 

} 

@property(nonatomic,retain) EigenRisicoViewController *eigenRisicoView; 
@property(nonatomic,retain) DeclaratieStatusViewController *declaratieStatusView; 
@property(nonatomic,retain) VergoedingenViewController *vergoedingenView; 
@property(nonatomic,retain) ZoekenZorgInstViewController *zoekenZorgInstView; 

@end 

Je suis nouveau au développement iPhone, Objective C et XCode, donc je ne comprends pas ce que signifie l'erreur ..

Est-ce que quelqu'un savoir ce que je fais mal?

Répondre

1

je besoin de voir la mise en œuvre ensemble, mais il semble que vous na pas @synthesize eigenRisicoView;

+0

C'était le problème ... Merci :) – Rick

Questions connexes