手机
当前位置:查字典教程网 >编程开发 >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开发:delegate、notification、KVO的选择

iPhone开发环境的安装

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

iOS 开发常用宏总结

iOS开发之UITableView详解

iOS时钟开发案例分享

iOS开发之UIScrollView控件详解

IOS开发:多线程NSThread和NSInvocationOperation

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

iOS开发之详解正则表达式

精品推荐
分类导航