iOS UITableViewController 新增一個固定的不能滾動的控制元件
阿新 • • 發佈:2019-01-27
新增一個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
}