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