0
我有一個名爲「sectionOpen」的方法的UITableViewController。在這個控制器中,我有一個帶有自定義標題的UITableView,它實際上是一個UIViewController。我已經附加了一個UITapGestureRecognizer,如果我在標題的視圖控制器上調用一個選擇器,它會起作用。調用超級查看選擇器(UITableViewController)
事情是我需要在UITableViewController而不是標題的視圖控制器上調用選擇器。
這裏是我的代碼:
// 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]);
}
如何調用sectionOpen上的UITableViewController從CustomSectionHeader?
提前感謝名單