我在tableView的footer上加了两个button,上面button可以响应事件,下面的button1却不能响应。
表示很奇怪查了方法实现及调用都没有问题,最后再网上查到。
-(void)setTableViewFooter
{
UIView *footerView = [[UIView alloc]initWithFrame: CGRectMake(0,
0,
_tableView.frame.size.width,
200)];
footerView.backgroundColor = [UIColor clearColor];
UIButton *button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
UIButton *button1=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self action:@selector(evaluatebuttonclick:) forControlEvents:UIControlEventTouchUpInside];
[button1 addTarget:self action:@selector(sharebuttonclick:) forControlEvents:UIControlEventTouchUpInside];
/*
...........
button尺寸
button.frame=CGRectMake(0, 20, 295,40);
button1.frame=CGRectMake(0, 20, 295,40);
// if(Screensize.height==480){
button.center = CGPointMake(self.view.frame.size.width/2, 30);
button1.center = CGPointMake(self.view.frame.size.width/2, 30+65-5);
// }
*/
[footerView addSubview:button];
[footerView addSubview:button1];
_tableView.tableFooterView = footerView;
}
原来button1超出了它的footerView的范围,点击不响应交互
但是button1仍会正常显示
解决办法:把superView调大点