UITableView DataSource
• - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) section { return [myStrings count]; }
Section(Group)
• - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) section { return [myStrings count]; }
Section (Row) •
UITableView DataSource
- 셀에 항목 삽입하기
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {
}
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@“MyIdentifier”]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:... reuseIdentifier:@“MyIdenifier”] autorelease]; } cell.text = [myStrings objectAtIndex:indexPath.row] return cell;
UITableView Delegate
- 셀 선택시 동작 지정
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *) indexPath {
}
// Get the row and the object it represents NSUInteger row = indexPath.row id objectToDisplay = [myObjects objectAtIndex:row];
// Create a new view controller and pass it along MyViewController *myViewController = ...; myViewController.object = objectToDisplay;
[self.navigationController pushViewController:myViewController animated:YES];
댓글 없음:
댓글 쓰기
참고: 블로그의 회원만 댓글을 작성할 수 있습니다.