手机
当前位置:查字典教程网 >编程开发 >IOS开发 >iOS开发基础:UITableView
iOS开发基础:UITableView
摘要:实现UITableView的Controller需要实现这两个代理,具体就是要实现以下两个方法:-(NSInteger)tableView:...

实现UITableView的Controller需要实现 < UITableViewDataSource, UITableViewDelegate > 这两个代理,具体就是要实现以下两个方法:

- (NSInteger)tableView:(UITableView *)tableView

numberOfRowsInSection:(NSInteger)section{

return [model getRowCount];

}

//返回UITableView的行数

- (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];

}

NSUInteger row = [indexPath row];

cell.textLabel.text = [model getNameAtIndex:row];

return cell;

}

//呈现UITableView的每一个Cell

【iOS开发基础:UITableView】相关文章:

iOS 前台和后台交互

iOS开发之详解正则表达式

iOS开发:队列和信号量该如何同步

iOS开发:开源框架和类

iOS开发中ViewController的页面跳转和弹出模态

iOS开发之UIScrollView控件详解

iOS应用开发中实现页面跳转的简单方法笔记

iOS开发ASIHTTPRequest数据压缩和Cookie的使用

iOS 开发常用宏总结

iOS开发之UIPickerView实现城市选择器的步骤详解

精品推荐
分类导航