UITableView设置Section间距

//section头部间距
- (CGFloat)tableView:(UITableView )tableView heightForHeaderInSection:(NSInteger)section
{
return 1;//section头部高度
}
//section头部视图
- (UIView
)tableView:(UITableView )tableView viewForHeaderInSection:(NSInteger)section
{
UIView
view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];
view.backgroundColor = [UIColor clearColor];
return view ;
}
//section底部间距
- (CGFloat)tableView:(UITableView )tableView heightForFooterInSection:(NSInteger)section
{
return 1;
}
//section底部视图
- (UIView
)tableView:(UITableView )tableView viewForFooterInSection:(NSInteger)section
{
UIView
view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];
view.backgroundColor = [UIColor clearColor];
return view;
}

文/代码干货(简书作者)
原文链接:http://www.jianshu.com/p/7364a11e1fc2
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。

时间: 2024-08-01 03:29:46

UITableView设置Section间距的相关文章

快速设置UITableView不同section对应于不同种类的cell

本文主要是为了写明如何在UITableView中,一个section对应于一种类型的cell,写起来不凌乱. 在不封装任何类的前提下提供如下源码: 请自行创建出3种类型的cell,创建好了就行,你需要创建出ModelOneCell,ModelTwoCell,ModelThreeCell,内容为空 // // RootViewController.m // Sections // // Copyright (c) 2014年 Y.X. All rights reserved. // #import

iOS开发——开发必备OC篇&UITableView设置界面完整封装(四)

设置界面完整封装(四) 简单MVC实现UITableView设置界面完善封装及拓展使用 关于使用和拓展, 其实基本上就是同UItableView,知识讲数据改一下就可以 拓展使用 1:首先定义一个数组用来装组的模型 // 总共的组数 @property (nonatomic, strong) NSMutableArray *groups; 2:懒数组 1 - (NSMutableArray *)groups 2 3 { 4 5 if (_groups == nil) { 6 7 _groups

IOS UITableView Group&Section

UItableView 根据数据结构不同 会有不同样式 关键在两个代理 tableviewdelegate&tabledatasourse 下面代码是我实施的Group 在模拟器中 ios6.1和ios7 并且滚动后相应的section会“置顶”,效果不错哦! 核心代码: #import <UIKit/UIKit.h> @interface AnnouncementViewController : UIViewController<UITableViewDataSource,UI

table中怎么设置两行间距

table中设置两行间距方法: css代码实现 <style> table   {   border-collapse:   separate;   border-spacing:   10px;   } </style> [/html]

UITableView设置背景图片

UITableView设置背景图片: 即设置tableView的backgroundView UIView *view = [[UIView alloc] init];    view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"view_bg_ipad.png"]];    self.tableView.backgroundView = view; UITableView设置背景图片

uitableview处理section的不悬浮,禁止section停留的方法

// //  ViewController.m //  qwerfresa // //  Created by  mac11 on 15-1-4. //  Copyright (c) 2015年 HYL. All rights reserved. // #import "ViewController.h" @interface ViewController ()<UITableViewDataSource,UITableViewDelegate>{ NSArray * ar

UITableView设置cell为不可选?

本文选自StackOverflow(简称:SOF)精选问答汇总系列文章之一,本系列文章将为读者分享国外最优质的精彩问与答,供读者学习和了解国外最新技术.本文将为读者讲解UITableView如何设置单元格属性为不可选? 问题: Mugunth 怎样才能设置UITableView的单元格属性为不可选择.我不想看到用户选择单元格时显示蓝色选择区域. 答案: Daniel Dickison 把表格单元格selectionStyle的属性设置为UITableViewCellSelectionStyleN

Android TextView 设置文字间距

搜索结果都不靠谱,基本上都说是android:textScaleX可以设置文字间距,也不知道你们到底有没有真正做过开发. Android开发文档里描述的很清楚: android:textScaleX Sets the horizontal scaling factor for the text. 这个东西是用来设置水平方向的文字放大和缩小的. 其实设置文字间距可以通过修改string.xml里的字符,在其中添加空格来实现. 但是在字符串中直接输入空格达不到想要的效果,这就需要使用转义字符来进行转

Android TextView 设置字间距和行间距

1.如果您是要设置TextView的行间距 请使用(不用看2了) android:lineSpacingMultiplier="1.8" 2.如果您是要设置字间距需要自定义控件 <pre name="code" class="java">import android.content.Context; import android.graphics.*; import android.text.TextUtils; import and