2012-03-29 87 views

回答

2

你正在看的视图是一个UITableView。如果您有多个条目,则此人的信息将随着“删除”按钮一起滚动屏幕。将按钮放在桌脚中将允许它与桌面一起滚动。表格页脚在任何部分之外。

如果您的视图没有任何滚动或动态大小的表格视图,您可以将其添加到视图的底部。

+0

我不明白你所说的“表页脚之外的任何部分的”的意思。 UITableView没有任何内置页脚AFAIK。只有单元格的部分有页眉/页脚 – pixelfreak 2012-03-29 20:46:37

+0

只是为了说明,我希望按钮与单元格一起滚动 – pixelfreak 2012-03-29 20:59:15

+0

UITableView有一个名为tableFooterView的属性,您可以在其中将其设置为任何UIView。它在任何部分之外。它将允许按钮与桌面一起滚动。 – bbarnhart 2012-03-29 21:00:26

0

如何使用工具栏与删除按钮?恕我直言,它会看起来“更好”。

0

您可以添加一个UIView,然后添加一个UIButton,以便UIButton无法自动调整为适合宽度。

7

创建一个新的UIView并将该视图设置为tableview的页脚视图并添加该按钮作为新UIView的子视图。另外,请在heightForFooterInSection方法中设置页脚的高度。

像这样的事情在viewDidLoad中,

- (void)viewDidLoad 
{ 
    UIView *newView = [[UIView alloc]initWithFrame:CGRectMake(10, 70, 300, 45)]; 
    submit = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
    [submit setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 
    //[submit setTitleColor:[UIColor colorWithWhite:0.0 alpha:0.56] forState:UIControlStateDisabled]; 
    [submit setTitle:@"Login" forState:UIControlStateNormal]; 
    [submit.titleLabel setFont:[UIFont boldSystemFontOfSize:14]]; 
    [submit setFrame:CGRectMake(10.0, 15.0, 280.0, 44.0)]; 
    [newView addSubview:submit]; 

    [self.tableView setTableFooterView:newView]; 

    [super viewDidLoad]; 

} 

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

    return 50; 
} 
相关问题