iOS開發(fā)基礎:UITableView
來源:易賢網(wǎng) 閱讀:1664 次 日期:2015-01-22 09:56:46
溫馨提示:易賢網(wǎng)小編為您整理了“iOS開發(fā)基礎:UITableView”,方便廣大網(wǎng)友查閱!

實現(xiàn)UITableView的Controller需要實現(xiàn) < UITableViewDataSource, UITableViewDelegate > 這兩個代理,具體就是要實現(xiàn)以下兩個方法:

- (NSInteger)tableView:(UITableView *)tableView

numberOfRowsInSection:(NSInteger)section{

return [model getRowCount];

}

//返回UITableView的行數(shù)

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

}

//呈現(xiàn)UITableView的每一個Cell

更多信息請查看IT技術(shù)專欄

更多信息請查看技術(shù)文章
易賢網(wǎng)手機網(wǎng)站地址:iOS開發(fā)基礎:UITableView
關于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點

版權(quán)所有:易賢網(wǎng)