In my view of DidLoad, I wrote this code:
UIView *footerView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(10,10, 300, 40); [btn setTitle:@"Select" forState:UIControlStateNormal]; [btn addTarget:self action:@selector(onClickSelect:) forControlEvents:UIControlEventTouchUpInside]; [footerView addSubview:btn]; myTableView.tableFooterView = footerView;
and my selection method:
- (void) onClickSelect: (UIButton*) sender { NSLog(@"selext"); }
but when I click the button (which I added as a table footer), the selection method is not called. Does anyone know what could be the problem?
source share