- 浏览: 1338988 次
- 性别:
- 来自: 成都
文章分类
- 全部博客 (471)
- 原创文章 (4)
- Database (84)
- J2SE (63)
- Web (26)
- Javascript (30)
- Lucene (11)
- os (13)
- 算法 (8)
- Webservice (1)
- Open projects (18)
- Hibernate (18)
- Spring (15)
- Css (2)
- J2ee (2)
- 综合技术 (18)
- 安全管理 (13)
- PatternsInJava (27)
- NIO (5)
- Ibatis (2)
- 书籍收藏 (1)
- quartz (7)
- 并发编程 (15)
- oracle问题 (2)
- ios (60)
- coco2d-iphone (3)
- C++ (6)
- Zookeeper (2)
- golang (4)
- animation (2)
- android (1)
最新评论
-
dandingge123:
【引用】限制UITextField输入长度的方法 -
qja:
...
对List顺序,逆序,随机排列实例代码 -
安静听歌:
现在在搞这个,,,,,哎~头都大了,,,又freemarker ...
通用大型网站页面静态化解决方案(一) -
springdata-jpa:
java quartz定时任务demo教程源代码下载,地址:h ...
Quartz 配置参考 -
马清天:
[b][/b][list][*]引用[u][/u][/list ...
通用大型网站页面静态化解决方案(一)
-、建立 UITableView
DataTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 420)];
[DataTable setDelegate:self];
[DataTable setDataSource:self];
[self.view addSubview:DataTable];
[DataTable release];
二、UITableView各Method说明
//Section总数
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{
return TitleData;
}
// Section Titles
//每个section显示的标题
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
return @"";
}
//指定有多少个分区(Section),默认为1
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 4;
}
//指定每个分区中有多少行,默认为1
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
}
//绘制Cell
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
SimpleTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier: SimpleTableIdentifier] autorelease];
}
cell.imageView.image=image;//未选cell时的图片
cell.imageView.highlightedImage=highlightImage;//选中cell后的图片
cell.text=//.....
return cell;
}
//行缩进
-(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{
NSUInteger row = [indexPath row];
return row;
}
//改变行的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 40;
}
//定位
[TopicsTable setContentOffset:CGPointMake(0, promiseNum * 44 + Chapter * 20)];
//返回当前所选cell
NSIndexPath *ip = [NSIndexPath indexPathForRow:row inSection:section];
[TopicsTable selectRowAtIndexPath:ip animated:YES scrollPosition:UITableViewScrollPositionNone];
[tableView setSeparatorStyle:UITableViewCellSelectionStyleNone];
//选中Cell响应事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];//选中后的反显颜色即刻消失
}
//判断选中的行(阻止选中第一行)
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
if (row == 0)
return nil;
return indexPath;
}
//划动cell是否出现del按钮
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
}
//编辑状态
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath
{
}
[topicsTable setContentSize:CGSizeMake(0,controller.promiseNum * 44)];
//右侧添加一个索引表
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{
}
//返回Section标题内容
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
}
//自定义划动时del按钮内容
- (NSString *)tableView:(UITableView *)tableView
titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
//跳到指的row or section
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO];
三、在UITableViewCell上建立UILable多行显示
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
UILabel *Datalabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 320, 44)];
[Datalabel setTag:100];
Datalabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:Datalabel];
[Datalabel release];
}
UILabel *Datalabel = (UILabel *)[cell.contentView viewWithTag:100];
[Datalabel setFont:[UIFont boldSystemFontOfSize:18]];
Datalabel.text = [data.DataArray objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
//选中cell时的颜色
typedef enum {
UITableViewCellSelectionStyleNone,
UITableViewCellSelectionStyleBlue,
UITableViewCellSelectionStyleGray
} UITableViewCellSelectionStyle
//cell右边按钮格式
typedef enum {UITableViewCellAccessoryNone, // don't show any accessory view
UITableViewCellAccessoryDisclosureIndicator, // regular chevron. doesn't track
UITableViewCellAccessoryDetailDisclosureButton, // blue button w/ chevron. tracks
UITableViewCellAccessoryCheckmark // checkmark. doesn't track
} UITableViewCellAccessoryType
//是否加换行线
typedef enum {
UITableViewCellSeparatorStyleNone,
UITableViewCellSeparatorStyleSingleLine
} UITableViewCellSeparatorStyle
//改变换行线颜色
tableView.separatorColor = [UIColor blueColor];
发表评论
-
ios 声音合成
2013-08-18 13:20 1300http://stackoverflow.com/ques ... -
__bridge,__bridge_retained和__bridge_transfer的意思,区别与使用 20 三
2012-12-24 01:41 1727使用ARC能帮我们减轻不少内存管理方面的负担,尤其是对用 ... -
CAAnimation
2012-12-23 01:09 2359CAAnimation采用了CAMediaTi ... -
UIViewAnimation动画与Core Animation的CATransition类动画
2012-12-23 01:06 2764使用UIView类函数实现://U ... -
GCD实战2:资源竞争
2012-12-23 01:04 1606转自http://www.dreamingwish.co ... -
GCD实战一:使用串行队列实现简单的预加载
2012-12-22 17:10 2933转自 http://www.dreamingwish.c ... -
GCD介绍(四): 完结
2012-12-22 17:08 1431转自 http://www.dreamingwish.c ... -
GCD介绍(三): Dispatch Sources
2012-12-22 17:07 1670转自 http://www.dreamingwish.com/ ... -
GCD介绍(二): 多核心的性能
2012-12-22 17:05 1222转自http://www.dreamingwish.co ... -
基本概念和Dispatch Queue
2012-12-22 17:03 1407转自 http://www.dreamingwish.c ... -
Best Audio Format for iPhone Audio Programming
2012-12-19 16:26 2582I had never done audio p ... -
LAME 是一个开源的MP3解码编码工具
2012-12-19 13:09 8639MP3 Encoding * 编码MP3文件必须按如下 ... -
sqlite3中的数据类型
2012-12-10 21:37 1353(转)http://www.cnblogs.com/kfqco ... -
ios随机数,and()、random()、arc4random()
2012-11-15 11:06 4741原文:http://bj007.blog.51cto.c ... -
IPHONE GIF 播放的方式
2012-10-11 18:30 1468转 http://blog.csdn.net/zltia ... -
在新线程中使用NSTimer
2012-10-11 18:21 1601转自 http://blog.csdn.net/sjzs ... -
Creating an iPhone Daemon – Part 5
2012-09-02 15:29 1546Creating an iPhone Daemon – ... -
Creating an iPhone Daemon – Part 4
2012-09-02 15:28 1417Creating an iPhone Daemon – ... -
Creating an iPhone Daemon – Part 3
2012-09-02 15:25 1515This is part three of the bl ... -
Creating an iPhone Daemon – Part 2
2012-09-02 15:24 1270Here is part two of the blog ...
相关推荐
在iOS开发中,UITableView是一种非常重要的视图组件,用于展示数据列表。当表格中的数据分为多个部分(sections)时,每个部分通常会有一个header视图,用来标识该部分的主题。然而,随着数据量的增大,如果对每个...
在iOS开发中,`UITableView` 是一种常用的组件,用于展示列表型数据。当我们需要在一个`UITableView`中显示两列数据时,通常会涉及到布局、数据源处理和自定义单元格等技术。以下将详细讲解如何实现这个功能。 首先...
iOS 开发中 UITableView 的使用详解 UITableView 是 iOS 开发中最常用的控件之一,用于显示列表数据。它类似于 Android 中的 ListView,都是用于显示列表数据的控件。在 iOS 开发中,UITableView 是一个非常重要的...
在iOS开发中,UITableView是一种非常常见的控件,用于展示数据列表。当应用的需求涉及多种不同类型的cell时,"UItableView多cell实现"就成为一个关键点。这个话题主要探讨如何优雅地处理UITableView中显示多种不同...
在iOS开发中,`UITableView` 是一个非常常用且强大的组件,用于展示列表数据。然而,在实际应用中,我们经常会遇到一个问题:当用户在`UITableView`中的输入框(如UITextField)中输入时,弹出的键盘可能会遮挡住...
在iOS开发中,UITableView是应用最广泛的一种控件,它被用来展示列表或者表格数据,类似于Android中的ListView。本教程将带你入门iPhone上的UITableView使用,通过一个简单的示例项目"**MyTableView**"来深入理解其...
在iOS开发中,UITableView是一种非常重要的组件,用于展示列表数据,通常用于实现类似通讯录、邮件列表等场景。而“可以左右滑动的UITableView”则是对原生UITableView功能的一种扩展,使得用户可以通过左右滑动...
在iOS开发中,UITableView是一种非常重要的控件,用于展示数据列表。这个“IOS iphone UITableView简单例子”是一个基础的教程,旨在帮助开发者理解如何在iPhone应用中实现UITableView的基本功能。在这个项目中,...
在iOS开发中,UITableView是一个非常重要的组件,用于展示列表数据,比如应用的设置菜单、联系人列表等。这个"UITableView2 Demo代码"很显然是一个示例项目,旨在演示如何实现UITableView的一些高级特性,包括缩进、...
在iOS开发中,UITableView是一种非常重要的视图组件,它用于展示列表数据,通常用于实现诸如联系人列表、新闻摘要等功能。本教程将详细介绍如何通过纯代码方式创建一个简单的UITableView,这对于初学者来说是一次很...
在Swift编程中,UITableView是一种非常重要的视图组件,用于展示列表数据。自定义UITableViewCell和管理数据的添加、删除以及刷新是开发iOS应用时常见的需求。接下来,我们将详细探讨如何在Swift中实现这些功能。 ...
UITableView是iOS开发中不可或缺的一部分,它是展示数据列表的首选控件。在iOS应用设计中,无论是展示联系人、邮件列表还是商品详情,UITableView都扮演着关键角色。本教程将深入探讨UITableView的简单使用,帮助...
在iOS开发中,UITableView是展示数据列表的一种常见控件,用户可以滚动浏览并进行交互。在实际应用中,我们经常需要实现对UITableView中的单元格(Cell)进行删除操作。本Demo代码着重展示了如何在UITableView中删除...
在iOS开发中,UITableView是一种常用的UI组件,用于展示列表数据。在进行自定义表视图操作时,我们可能需要对单元格(UITableViewCell)的编辑功能进行控制,比如隐藏默认的删除按钮或者更改其标题。本篇文章将深入...
在iOS开发中,UITableView是一种常用的组件,用于展示列表数据。本话题主要关注如何实现一个功能,即`UITableView`中按照汉字或英文名字的首字母进行排序和分组,类似于我们常见的通讯录应用。这个功能的核心在于对...
在iOS开发中,UITableView是一种常用的UI组件,用于展示列表数据。`UITableView`的缩放和展开功能通常是通过自定义扩展来实现的,特别是在构建类似下拉菜单或树形结构的界面时。`UITableViewDropDown`的概念可能指的...
在iOS开发中,`UITableView` 是一个非常常用的组件,用于展示列表数据。有时,开发者可能需要将整个`UITableView`的内容截图并保存为一张长图片,例如为了分享或记录用户当前的状态。这个过程涉及到屏幕截图、滚动...
在iOS开发中,UITableView是一种常用的数据展示控件,用于创建列表或表格视图。当涉及到更复杂的层级结构,如三级菜单,我们需要巧妙地利用UITableView的特性来实现。在这个主题下,我们将深入探讨如何构建一个支持...
在这个特定的场景中,我们讨论的是如何实现一个"长按即可移动cell的UITableView"功能,这通常涉及到手势识别、自定义行为以及对UITableView的深入理解。 首先,我们要引入`UILongPressGestureRecognizer`手势识别器...