标题 | iOS开发基础:UITableView |
内容 | 实现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 |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。