UITableViewCell使用小结
来源:互联网 发布:泓樽付是网络传销吗 编辑:程序博客网 时间:2024/06/07 02:23
#pragma mark - tableView的数据源方法,和代理方法
/** 每个分组的数据行数,如果分组返回不同的行数可以用switch来做,如果单个列表直接返回想要的行数 */
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 0;
}
/** 返回单元格的明细,通过索引的section和row来确定*/
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
return nil;
}
/** 分段显示数据,可以分段或单列表形势 */
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 5;
}
#pragma mark - tableView的委托方法- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
return 180;
}else if (indexPath.section == 1){
return 120;
}else if(indexPath.section == 4){
if (indexPath.row == 0) {
return 35.0;
}else{
return 100.0;
}
}else{
return 70.0;
}
}
/** 设置分组标题内容宽度 */
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section == 0) {
return 1;
}else{
return 5;
}
}
/** 设置尾部说明内容宽度 */
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 5;
}
/** 设置分组标题头前的view */
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREENHEIGHT, 10)];
headerView.backgroundColor = RGB(239, 239, 244);
return headerView;
}
/** 设置分组标题尾的view */
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREENWIDTH, 0)];
footerView.backgroundColor = RGB(239, 239, 244);
return footerView;
}
/** 行点击 */
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section ==3) {
NSString *urlStr = [[GetUrlString sharedManager]urlWithHotQueueWebData];
JFHotQueueViewController *hotQueueVC = [[JFHotQueueViewController alloc]init];
hotQueueVC.urlStr = urlStr;
[self.navigationController pushViewController:hotQueueVC animated:YES];
}else if(indexPath.section ==4){
if (indexPath.row !=0) {
JFRecommentModel *recommendModel = _recommentArray[indexPath.row-1];
JFShopDetailViewController *shopDetailVC = [[JFShopDetailViewController alloc]init];
shopDetailVC.shopID =[recommendModel.id stringValue];
[self.navigationController pushViewController:shopDetailVC animated:YES];
}
}
}
/*设置标题尾的名称*/
-(NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
if (section == 0)
{
return @"标题尾1";
}
else
{
return @“标题尾";
}
}
/*设置标题头的名称*/
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
if (section == 0) {
return @"标题头1";
}
else
return @"标题头2";
}
- UITableViewCell使用小结
- UITableViewCell小结
- UITableViewCell使用
- 代码动态创建UITableViewCell小结
- IOS UITableViewCell的使用
- 使用代码创建UITableViewCell
- UITableViewCell的基本使用
- UITableViewCell使用Autolayout
- UITableViewCell的使用介绍
- UITableViewCell?的 使用
- UITableViewCell的简单使用
- 使用Xib自定义UITableViewCell
- 使用UITableViewCell的自定义子类
- 使用xib文件自定义UItableViewCell
- UITableView与UITableViewCell的使用
- 使用xib文件创建UITableViewCell
- UITableviewCell使用以及自定义高度
- UITableviewCell使用以及自定义高度
- 【图】BFS和DFS
- C#中两个窗口怎么传递参数?或者怎么使用另一个窗口的控件呢?
- 51nod 1387 移数字(多项式除法)
- 第三周 项目1:个人所得税计算器
- soledede--泰勒级数
- UITableViewCell使用小结
- c 笔记
- Lua中的metatable详解
- 非常实用的30天学习30种技术
- vim编码转换和文件模式类型转换
- 进制转换
- 跟着廖雪峰的git教程学习(2)时光机穿梭(三)管理修改
- 今天遇到的异常,处理了很长时间
- C#版三层登录