手机
当前位置:查字典教程网 >编程开发 >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开发:Notification与多线程

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

iOS时钟开发案例分享

iOS4下实现UIView动画结束后调用

IOS开发:Cocoa的类与对象

iOS开发之路--微博骨架搭建

详解iOS开发中的转场动画和组动画以及UIView封装动画

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

精品推荐
分类导航