我的表視圖的工作和tableFooterView
做定製。什麼我做的是:按鈕不響應點擊事件,
ClassA.m
- (void)viewDidLoad
{
FooterViewController *footerView = [[FooterViewController alloc] initWithNibName:@"FooterViewController" bundle:nil];
// Add selector of Class A to checkOutButton
[footerView.checkOutButton addTarget:self action:@selector(goToCheckOut) forControlEvents:UIControlStateNormal];
self.shoppingListTable.tableFooterView.backgroundColor = [UIColor clearColor];
self.shoppingListTable.tableFooterView = footerView.view;
}
- (void)goToCheckOut {
NSLog(@"this is a response from a button");
}
FootViewController.h
@interface FooterViewController : UIViewController
@property (strong, nonatomic) IBOutlet UILabel *amount;
@property (strong, nonatomic) IBOutlet UIButton *checkOutButton;
@end
出口也連接到XIB文件以及
然而,當我點擊按鈕,它根本沒有迴應,日誌中什麼也沒有顯示出來......
我在做什麼錯在這裏。如果您對此有任何想法,請提供幫助。因爲設置了錯誤的forControlEvents
參數
[footerView.checkOutButton addTarget:self action:@selector(goToCheckOut) forControlEvents:UIControlEventTouchUpInside];
我知道我在做什麼錯在這裏。首先,我做了一個像你說的改變,然後在將'footerView.view'分配給'self.shoppingListTable.tableFooterView'後,我必須交換'addTarget'行。 – tranvutuan