iOS--tableview分组
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
) {
;
}else{
;
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 20.0;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *reuseIdentifier= @"reuseIdentifier";
PersonalTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
if (cell == nil) {
cell = [[PersonalTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
}
switch (indexPath.section) {
:{
) {
cell.leftImg.image = [UIImage imageNamed:@"sjq_home20.png"];
cell.nameLabel.text = @"图文";
}){
cell.leftImg.image = [UIImage imageNamed:@"sjq_readMode2.png"];
cell.nameLabel.text = @"文章";
}){
cell.leftImg.image = [UIImage imageNamed:@"sjq_music2.png"];
cell.nameLabel.text = @"歌单";
}else{
cell.leftImg.image = [UIImage imageNamed:@"sjq_movice2.png"];
cell.nameLabel.text = @"电影";
}
}
break;
:{
) {
cell.leftImg.image = [UIImage imageNamed:@"nightType.png"];
UISwitch *switchview = [[UISwitch alloc] initWithFrame:CGRectZero];
[switchview addTarget:self action:@selector(updateSwitchAtIndexPath:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView = switchview;
switchview.on = [User moodsession];
//指定开关两种状态下背景颜色和滑动杆颜色
[[UISwitch appearance] setOnTintColor:[UIColor colorWithRed:///]];
cell.nameLabel.text = @"夜间模式";
}){
cell.leftImg.image = [UIImage imageNamed:@"otherShezhi.png"];
cell.nameLabel.text = @"其他设置";
}
}
break;
default:
break;
}
if ([User moodsession]) {
cell.backgroundColor = [UIColor colorWithRed:///];
cell.nameLabel.textColor = [UIColor colorWithRed:///];
self.tableview.backgroundColor = [UIColor grayColor];
}else{
cell.backgroundColor = [UIColor whiteColor];
self.tableview.backgroundColor = [UIColor whiteColor];
cell.nameLabel.textColor = [UIColor blackColor];
}
cell.textLabel.font = [UIFont systemFontOfSize:];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
switch (indexPath.section) {
:{
) {
PersonTuWenViewController *PersonTuWenView = [self.storyboard instantiateViewControllerWithIdentifier:@"PersonTuWenView"];
PersonTuWenView.charidFromTop = self.loginUser.userId;
[self.navigationController pushViewController:PersonTuWenView animated:YES];
}){
}){
}){
}
}
break;
:{
) {
}else{
QiTasetViewController *qitaset = [self.storyboard instantiateViewControllerWithIdentifier:@"qitaset"];
[self.navigationController pushViewController:qitaset animated:YES];
}
}
break;
default:
break;
}
}
效果图:
iOS--tableview分组的更多相关文章
- ios tableview 上加 textfiled
ios tableview 上加 textfiled 首先附上我项目中用曾经用到的几张图 并说明一下我的用法: 图1: 图2: 图3: 心在你我说一下 我当初的实现 方法 ,希望能给你们一些 启 ...
- iOS TableView多级列表
代码地址如下:http://www.demodashi.com/demo/15006.html 效果预览 ### 一.需求 TableView多级列表:分级展开或合并,逐级获取并展示其子级数据,可以设 ...
- iOS tableview cell 的展开收缩
iOS tableview cell 的展开收缩 #import "ViewController.h" @interface ViewController ()<UITabl ...
- iOS tableview的常用delegate和dataSource执行顺序
在这次项目中遇到了一个特别奇葩的问题:表视图创建的cell在7以上的系统能正常运行显示,在模拟器上就不能正常实现......为解决这个问题,纠结了好久...... 对在7系统上不显示的猜测: 用mas ...
- IOS tableview下拉刷新上拉加载分页
http://code4app.com/ios/快速集成下拉上拉刷新/52326ce26803fabc46000000 刷新没用用插件,加载使用的MJ老师的插件. - (void)viewDidLoa ...
- iOS tableView 静态单元格的实现
本文转自:http://home.cnblogs.com/u/wendingding/ iOS开发UI篇—简单介绍静态单元格的使用 一.实现效果与说明 说明:观察上面的展示效果,可以发现整个界面是由一 ...
- iOS tableview 优化总结
根据网络上的优化方法进行了总括.并未仔细进行语言组织.正在这些优化方法进行学习,见另一篇文章 提高app流畅度 1.cell子控件创建写在 initWithStyle:reuseIdentifier ...
- 【转】ios tableView那些事(一)创建一个简单的tableView
工作也有半年多了!几乎每个项目中的会用到tableview这个神奇而好用的控件,在学习和工作中都会看别人的博客!对我有很大的帮助,就如同站在巨人的肩膀上的感觉吧 哈哈!于是决定重新开始写博客,希望能帮 ...
- IOS UITableView分组列表
UITableView有两种风格:UITableViewStylePlain和UITableViewStyleGrouped.这两者操作起来其实并没有本质区别,只是后者按分组样式显示前者按照普通样式显 ...
- iOS:分组的表格视图UITableView,可以折叠和展开
虽然表格视图可以分组,但是如果分组后,每一行的内容太多,往后翻看起来比较的麻烦.为了解决这个麻烦,可以将分组的行折叠和展开.折叠时,行内容就会隐藏起来:展开时,行内容就会显示出来. 折叠时: 展开后: ...
随机推荐
- MegaCLI SAS RAID Management Tool
MegaCLI SAS RAID Management Tool Ver 8.04.08 July 05, 2012 (c)Copyright 2011, LSI Corporation, A ...
- MultiWii MWC的软件和调试方法
(如果你的电脑是win7 64位的系统,安装了JAVA虚拟机后GUI仍然运行不了,那你就需要到C:\Program Files\Java\jre7\bin\找到并复制javaw.exe,然后粘贴到C: ...
- codevs 2449 骑士精神 (IDDfs)
/* 限制步数 写迭代加深 注意剪枝:当先步数+不同的个数-1>当前限制的步数 就cut */ #include<cstdio> #include<cstring> #i ...
- hdu 2187
#include <stdio.h> using namespace std; struct race { int p; int w; }; race r[1010]; int cmp(r ...
- Hadoop源码解析之 rpc通信 client到server通信
rpc是Hadoop分布式底层通信的基础,无论是client和namenode,namenode和datanode,以及yarn新框架之间的通信模式等等都是采用的rpc方式. 下面我们来概要分析一下H ...
- Xcode 运行报错:“Your build settings specify a provisioning profile with the UUID ****** however, no such provisioning profile was found”
iOS开发中遇到"Your build settings specify a provisioning profile with the UUID ****** however, no su ...
- poj2236 基础并查集
题目链接:http://poj.org/problem?id=2236 题目大意:城市网络由n台电脑组成,因地震全部瘫痪,现在进行修复,规定距离小于等于d的电脑修复之后是可以直接相连 进行若干操作,O ...
- 实现DIV拖动
Ajax的到来让B/S中的客户端中开发有火了一把,网上出现了很多优秀的开源框架和UI,比较著名了有prototype,YUI,GWT等,但很多时候发现这些东西很难用到你的系统之中,有时候你的系统仅仅需 ...
- Python自动化运维之10、模块之json、pickle、XML、PyYAML、configparser、shutil
序列化 Python中用于序列化的两个模块 json 用于[字符串]和 [python基本数据类型] 间进行转换 pickle 用于[python特有的类型] 和 [python基本数据类 ...
- OpenStack点滴01-概览
OpenStack项目由Rackspace和NASA(美国国家航空航天局)共同发起,它是一个旨在为公共及私有云的建设与管理提供软件的开源项目. 作为一个开源云平台,OpenStack的首要任务是简化云 ...