iOS UITableViewController 添加一个固定的不能滚动的控件

来源:互联网 发布:优化的南洋金珠会掉色 编辑:程序博客网 时间:2024/05/17 03:47

添加一个button 等宽与视图的宽度

    tryButton = [UIButtonbuttonWithType:UIButtonTypeCustom];

    tryButton.frame =CGRectMake(0,self.view.frame.size.height-44,self.view.frame.size.width,44);

    // [tryButton setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];

    [tryButtonsetBackgroundColor:[UIColorredColor]];

    [tryButtonaddTarget:selfaction:@selector(tryButtonAction)forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:tryButton];


添加在scrollView方法里设置坐标即可


-(void)scrollViewDidScroll:(UIScrollView *)scrollView

{

    tryButton.frame =CGRectMake(0, (self.tableView.frame.size.height - 150) + self.tableView.contentOffset.y , tryButton.frame.size.width,tryButton.frame.size.height);

}

2 0
原创粉丝点击