手机
当前位置:查字典教程网 >编程开发 >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开发之UITableView详解

iPhone开发环境的安装

iOS 前台和后台交互

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

iOS推送之本地通知UILocalNotification

详解iOS App中UITableView的创建与内容刷新

iOS App开发中的UIPageControl分页控件使用小结

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

IOS开发:Notification与多线程

精品推荐
分类导航