0
我有一個按鈕的章節頁腳,但我不知道如何檢測在我的TableView中點擊了哪個頁腳。我知道我必須使用「標籤」之類的東西,但是怎麼樣?爲頁腳創建按鈕並檢測正確點擊
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
self.footerHeartView = [[UIView alloc]initWithFrame:CGRectMake(10, 0, 300, 60)];
[self.footerHeartView addSubview:viewFotter];
UIView *viewFotter = [[UIView alloc]initWithFrame:CGRectMake(10, 0, 300, 60)];
self.heartButton = [[UIButton alloc]initWithFrame:CGRectMake(200, 5, 70, 50)];
self.heartButton.tag = section;
self.heartButton.backgroundColor = [UIColor greenColor];
[self.heartButton addTarget:self
action:@selector(heartClick:)
forControlEvents:UIControlEventTouchUpInside];
[viewFotter addSubview:self.heartButton];
[viewFotter setBackgroundColor:[UIColor whiteColor]];
return self.footerHeartView;
}
- (void)heartClick:(UIButton*)sender {
NSLog(@"CLICK");
[[GTAppController sharedInstance].api sendLike:1 itemId:[[self.newsList objectAtIndex:???????]objectForKey:@"testId"]];
}
感謝您的時間!