2010-08-17 4 views
0

J'ai un UITableViewController avec une méthode appelée "sectionOpen". Dans ce contrôleur, j'ai un UITableView avec des en-têtes personnalisés, qui sont en fait un UIViewController. Je lui ai attaché un UITapGestureRecognizer, cela fonctionne si j'appelle un sélecteur sur View Controller de l'en-tête. Le truc, c'est que je dois appeler un sélecteur sur le UITableViewController et non sur le View Controller de l'en-tête.Sélecteur d'appel sur superview (UITableViewController)

Voici mon code:

// UITableViewController .m 
    - (IBAction) sectionOpen:(UITapGestureRecognizer)recognizer { 
    //Do Something 
    } 


// Header CustomSectionHeader .h 
    @interface CustomSectionHeader : UIViewController { 
     id delegate; 
    } 
    @property (nonatomic, retain) id delegate; 


//Header CustomSectionHeader .m 
    @synthesize delegate; 
- (id) initWithSection:(NSInteger)section delegate:(id)aDelegate { 

    if (self = [super init]) { 
     self.delegate = aDelegate; 
     [self delegateSetUp]; 


     UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sectionOpen:)]; 
     [self.view addGestureRecognizer:tapGesture]; 
     [tapGesture release]; 

    } 

    return self; 
} 

- (void) delegateSetUp { 
    [self setDelegate:self.delegate]; 
    NSLog(@"DELEGATE: %@", [self delegate]); 
} 

Comment appeler sectionOpen sur UITableViewController de CustomSectionHeader?

Thanx à l'avance

Répondre

0

Essayez quelque chose comme

... initWithTarget:aDelegate ... 

Je ne sais pas ce que "delegateSetUp" est censé faire; ça ne semble rien faire.

Questions connexes