搜索
您的当前位置:首页正文

tableViewHeader 点击事件无效果

来源:知库网

-(UIView*)tableView:(UITableView*)tableView viewForFooterInSection:(NSInteger)section{

CGFloat height = 87;

UIView *footerView =[[UIView alloc] initWithFrame:CGRectMake(0,0,KSCREENWIDTH, height)];

footerView.backgroundColor= [UIColor clearColor];

UILabel *footTipLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, height -26-35,KSCREENWIDTH,35)];

footTipLabel.font= [UIFont systemFontOfSize:13];

footTipLabel.textColor=COLOR_WITH_RGB(144,144,144,1);

footTipLabel.textAlignment=NSTextAlignmentCenter;

footTipLabel.numberOfLines=0;

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:selfaction:@selector(clickPhoneNum)];

[footTipLabel addGestureRecognizer:tap];

footTipLabel.userInteractionEnabled=YES;

[footerView addSubview:footTipLabel];

return footerView;

}

代码写的表尾,显示很正常,就是点击无效果

后来发现把设置表尾高度的代码删除了

-(CGFloat)tableView:(UITableView*)tableView heightForFooterInSection:(NSInteger)section{

    CGFloat height = 87;

    return height;

}

结果点击事件无响应,个人猜测应该是表尾添加到表上了,显示是默认按照设置的高度显示的。但是设置的表尾的高度为默认高度,达不到整个表尾的高度,显示在类似背景的图层上,新添加的东西放在那个位置上就会被盖住,所以点击区域所在位置是不可被点击的。

Top