- (UIView *) tableView:(UITableView *)tableView1 viewForHeaderInSection:(NSInteger)section
{
NSString *sectionTitle = [self tableView:tableView titleForHeaderInSection:section];
if (sectionTitle == nil) {
return nil;
}
UILabel * label = [[[UILabel alloc] init] autorelease];
label.frame = CGRectMake(0, 0, 320, 22);
// label.backgroundColor = [UIColor clearColor];
// label.backgroundColor = [UIColor redColor];
label.font=[UIFont fontWithName:@"Helvetica-Bold" size:14];
label.text = sectionTitle;
UIView * sectionView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 220)] autorelease];
[sectionView setBackgroundColor:[UIColor blackColor]];
[sectionView addSubview:label];
return sectionView;
}
分享到:
相关推荐
对于ios7,ios8及以上来说,调整UITableView的cell的分割线位置已经是相当不便,因为UITableView内部使用了margin layout. 其实只需要如下这样子就可以实现分割线的控制。 代码如下: -(void)tableView:(UITableView...
一、带索引目录的表视图 ... NSArray *sectionTitles; // 每个分区的标题 NSArray *contentsArray; // 每行的内容 } /** @brief 准备数据源 在viewDidLoad方法中调用*/ – (void)readySource {
支持纵向布局和横向布局,可以根据不同的section设置不同的布局,支持拖动cell,头部悬浮,设置section背景色和自定义section背景view,向自定义背景view传递自定义方法。实现了电影选座等高难度的布局。特别感谢...
一、UITableView基本介绍 默认的UITableView有2种风格: UITableViewStylePlain(不分组) UITableViewStyleGrouped(分组) UITableView中的数据只有行的概念,没有列的概念,UITableView的每行数据就是一个...
实现UITableView Plain样式section headView和tableview的一起滑动, 在自定义HeadSectionView中重写setFrame方法: - (void)setFrame:(CGRect)frame{ CGRect sectionRect = [self.tableView rectForSection:self....
这个应该是最常见而且不容易被发现的原因,起因是iOS7在Conttoller中新增了automaticallyAdjustsScrollViewInsets这个属性,当设置为YES时(默认YES),如果视图里面存在唯一一个UIScrollView或其子类View,那么它...
SwiftReorder是一个UITableView扩展,可让您将长按拖放重新排序添加到任何表视图中。 它功能强大,轻巧且可完全自定义。 特征 流畅的动画 自动边缘滚动 适用于多个表节 可自定义的阴影,缩放和透明效果 安装 可可豆...
列表类--Section Selection View 列表类--Styled TableViewCell 列表类--TableView的各种操作 列表类--UIListView 列表类--下拉刷新加载SQLite数据 列表-让TableView的子view保持固定 列表之ExpansionTableView ...
自定义UITableView 的 section 选择视图。即在UITableView的左侧(或右侧)增加section的选择框,手指可以滑动选择框迅速选择某个section。 Code4App编译测试,适用环境:Xcode 4.5, iOS 6.0。
表视图是iOS开发中最重要的视图,它以列表的形式展示数据。表视图又一下部分组成: 表头视图:表视图最上边的视图 表脚视图:表视图最下边的视图 单元格(cell):表视图中每一行的视图 节(section):由多个单元格...
ViewElements 通过组成元素以声明方式构建UITableView 。 重要说明:这项工作仍在进行中。 可以在生产中使用,但要小心。特征支持的视图类型: 行( UITableViewCell ) SectionHeader,SectionFooter( ...
创建一个临时数组selectedArr存储需要展开的section。点击section是判断selectedArr是否包含该组,如果包含则移除,不包含则添加到selectedArr。 展示selectedArr包含组的cell。 二、代码实现 #import ...
这是一些特殊动画效果的列表效果,该源码效果可以实现了自定义各种参数,多达20多种,来定义index的外观和动画效果,大家可以下载参考一下吧,希望可以能够帮到大家。 使用说明: - (void)viewDidLoad { [super ...
作者Flying-Einstein,源码CollectionViewTest,实现垂直方向的单列表来说,使用UITableView足以;若是需要构建横向滑动列表、gridView等直线型布局,则使用UICollectionView+UICollectionViewFlowLayout搭建最合适...