继承自UITableViewController 需要添加按钮到最上层
发现self.view 添加的话 tableView滑动的时候 按钮也是跟着滑动的
#pragma mark 创建上架按钮悬浮按钮
-(void)creatDownBtn
{
self.suspensionBtn = [UIButtonbuttonWithType:UIButtonTypeCustom];
self.suspensionBtn.frame = CGRectMake(20,kScreenHeight -90,kScreenWidth -40,50);
[self.suspensionBtnsetTitle:self.titleforState:UIControlStateNormal];
self.suspensionBtn.layer.cornerRadius = 10;
self.suspensionBtn.backgroundColor =KThemeColor;
[self.suspensionBtnaddTarget:selfaction:@selector(grounding)forControlEvents:UIControlEventTouchUpInside];
[self.tableViewaddSubview:self.suspensionBtn];
[self.tableViewbringSubviewToFront:self.suspensionBtn];
btnY = (int)self.suspensionBtn.frame.origin.y;
}
#pragma mark 实现代理方法固定悬浮按钮的位置
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
self.suspensionBtn.frame =CGRectMake(20,btnY+self.tableView.contentOffset.y , kScreenWidth - 40, 50);
}