相关疑难解决方法(0)

如何更改分组UITableView标头的高度?

我知道如何在表视图中更改节标题的高度.但我无法找到任何解决方案来更改第一部分之前的默认间距.

现在我有这个代码:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section == 0){
        return 0;
    }
    return 10;
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

uitableview uikit tableview ios

83
推荐指数
5
解决办法
6万
查看次数

UITableView:从空部分隐藏标题

我有一个UITableView,显示当月的费用(见截图):

我的问题是空部分的标题.有没有办法隐藏它们?数据从coredata加载.

这是生成标题标题的代码:

TitleForHeader

-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
if ([tableView.dataSource tableView:tableView numberOfRowsInSection:section] == 0) {
    return nil;
} else {

NSDate *today = [NSDate date ];
int todayInt = [dataHandler getDayNumber:today].intValue;

NSDate *date = [NSDate dateWithTimeIntervalSinceNow:(-(todayInt-section-1)*60*60*24)];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:[[NSLocale preferredLanguages] objectAtIndex:0]]];    
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
NSString *formattedDateString = [dateFormatter stringFromDate:date];
    return formattedDateString;}

}
Run Code Online (Sandbox Code Playgroud)

ViewForHeader

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
if ([tableView.dataSource tableView:tableView numberOfRowsInSection:section] == 0) {
    return nil;
} else {

    UIView *headerView = …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview tableview ios

73
推荐指数
7
解决办法
6万
查看次数

iOS - viewForFooterInSection坚持UITableView的底部

我有一个有3个部分的UITableView.他们每个都有一个我使用viewForFooterInSection添加的页脚.我遇到的问题是,当我向下滚动桌面视图时,页脚会粘到屏幕的底部,而不会像其他单元格那样滚动.有没有人知道如何制作它,所以页脚几乎就像一个单元格,并与表格的其余部分一起滚动?谢谢!

cocoa-touch objective-c uitableview uiview ios

7
推荐指数
2
解决办法
1万
查看次数

标签 统计

ios ×3

uitableview ×3

objective-c ×2

tableview ×2

cocoa-touch ×1

uikit ×1

uiview ×1