UITableView与UITableViewCell的使用
来源:互联网 发布:淘宝行业分析软件 编辑:程序博客网 时间:2024/05/16 09:24
<pre name="code" class="objc">DataSource //设置<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;">DataSource协议代理人</span>
Delegate //设置UITableView是协议代理人
DataTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 420)]; //设置布局[DataTable setDelegate:self];[DataTable setDataSource:self];[self.view addSubview:DataTable];[DataTable release];
//设置每个分区标题栏
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{return TitleData;}
//指定有多少个分区(Section),默认为1- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {return 4;}
//绘制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;}
在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;}
0 0
- UITableView与UITableViewCell的使用
- UITableView与UITableViewCell的透明度
- UITableView使用<2>UITableViewCell的介绍
- UITableView与UITableViewCell
- UITableView与UITableViewCell
- UITableView与UITableViewCell
- UITableView与UITableViewCell
- UITableView与UITableViewCell
- UITableView与UITableViewCell
- UITableView与UITableViewCell
- iphone开发之表格组件UITableView的使用(五)UITableView与UItableViewCell常见属性以及单元格重用
- 代码实现 UITableView与UITableViewCell
- iOS开发:UITableView与UITableViewCell
- 代码实现 UITableView与UITableViewCell
- 代码实现 UITableView与UITableViewCell
- 代码实现 UITableView与UITableViewCell
- UITableView和UITableViewCell的一点使用小总结
- 使用自定义的tableViewCell- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS
- Linux为联网汽车提供开放的汽车级软件栈
- MFC中Spin控件的使用
- android 版本简介
- C#关于List的find的误解
- UIView 中Clip Subviews不起作用?
- UITableView与UITableViewCell的使用
- 做好SCM,需要看的一些书籍
- 优化网站响应时间
- 经典算法之杨辉三角形
- 解决2008系统中使用java的Date获取时间总是比实际时间差了8个小时的问题
- 通过RTTI使Delphi和JavaScript互通
- ubuntu vmplayer安装vmtool
- 桥接模式
- 透视WebMVC