viewForFooterInSection未顯示在屏幕底部(uitableview)。 這裏我使用的是UItableview。 viewForFooterInSection未顯示在屏幕底部
注意:在屏幕下方可以看到屏幕底部增加了一個頁腳(白色視圖)。 Redcolorview:頁腳(從下面的代碼) 藍色:表背景顏色 白色底:
我加了編程,使用下面的代碼紅色的看法:
- (CGFloat)tableView:(UITableView *)tableView
estimatedHeightForFooterInSection:(NSInteger)section
{
return 44;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
NSLog(@"%f",tableView.frame.size.width);
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 44)];
view.backgroundColor = [UIColor redColor];
UIButton *cancelButton = [[UIButton alloc]initWithFrame:CGRectMake(30, 7, tableView.frame.size.width/2 - 60, 30)];
[cancelButton setTitle:@"Cancel" forState:UIControlStateNormal];
[cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[cancelButton setBackgroundColor:[ValidationsClass colorWithHexString:NSLocalizedStringFromTableInBundle(@"pothysapp_label_text_backgroundcolor",@"ApplicationSettings",[NSBundle mainBundle], nil)]];
[cancelButton addTarget:self
action:@selector(cancelDetails:)
forControlEvents:UIControlEventTouchUpInside];
cancelButton.titleLabel.font = [UIFont fontWithName:@"Roboto-Bold" size:15];
cancelButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[view addSubview:cancelButton];
UIButton *saveButton = [[UIButton alloc]initWithFrame:CGRectMake(tableView.frame.size.width/2 + 30, 7, tableView.frame.size.width/2 - 60, 30)];
[saveButton setTitle:@"Save" forState:UIControlStateNormal];
[saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[saveButton setBackgroundColor:[ValidationsClass colorWithHexString:NSLocalizedStringFromTableInBundle(@"pothysapp_label_text_backgroundcolor",@"ApplicationSettings",[NSBundle mainBundle], nil)]];
[saveButton addTarget:self
action:@selector(saveDetails:)
forControlEvents:UIControlEventTouchUpInside];
saveButton.titleLabel.font = [UIFont fontWithName:@"Roboto-Bold" size:15];
saveButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[view addSubview:saveButton];
return view;
}
節的頁腳將不會出現在表視圖部分的底部,除非你的部分具有足夠的細胞覆蓋屏幕。 – dip
檢查以下鏈接可能對您有用https://stackoverflow.com/a/7238601/5184217 –