iOS tableview의 sectionheader는 기본적으로 스크롤할 때 상위에 고정으로 잡혀있게 된다. sectionheader 까지 스크롤이 가능하게 할 수 있는 코드가 있다. 물론 tableview를 scriollview로 감싸는 방법도 있지만.. 다음 코드를 삽입하자. sectionheader까지 스크롤이 가능하다 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat sectionHeaderHeight = mTableView.sectionHeaderHeight; if (scrollView.contentOffset.y=0) { scrollView.contentInset = UIEdgeInsetsMake(-scrollView.conte..
tableview 최상단으로 이동 [mTable setContentOffset:CGPointMake(0, 0) animated:NO]; 테이블뷰 갱신이나 reload 시 자주 써먹게 되는 방법 update테이블뷰 최하단으로 이동 [filedata count]은 row의 전체갯수이며 row의 마지막값은 전체갯수보다 항상 -1 작으므로 [filedata count] - 1 NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[filedata count] - 1 inSection:0]; [mTable scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YE..
테이블뷰 다음 페이지 불러오기 테이블뷰 메소드에 이런 게 있었다니 ...방금 급 발견하고 더보기 기능 구현 이전에는 위 이미지처럼 테이블뷰 마지막 셀을 하나 추가해서 버튼을 클릭했을 때 다음 페이지를 불러오도록 구현했는데,, 어떤 어플에 마지막 셀이 보여질 때 자동으로 다음데이터를 불러오는 기능을 본후 언젠가는 해봐야 겠다고 생각 하던중! 구글링으로 아래 메소드를 찾음.. willDisplayCell *코드 설명- 파싱데이터 셀에 뿌려주는 형식이며 20개씩 불러오고 총 데이터가 20개 이상일 numberOfRowsInSection 카운트 +1 해준다. More 버튼을 넣기 위해서.. - 만약 More 버튼 없이 구현하기 위해서는 아래 데이터의 [getData count]를 [getData count] -..
테이블뷰 사용시 cell을 동적으로 추가하거나 삭제해야 하는 경우가 발생한다. 이럴 때 사용하는 소스코드 예를들어 cuscell *cus; //CustomCell UITableView *table; NSMutableArray *data; data = [NSMutableArray arrayWithObjects:@"Item 1", @"Item 2", nil]; 를 선언하고 테이블뷰에서 data의 값을 가져온다고 하자. cell 추가 [self.data addObject:@"New Item"]; [table beginUpdates]; NSArray *paths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:1 inSection:0]]; [table inse..
//테이블뷰 섹션의 수 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 2; } //테이블뷰 Row의 갯수 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; } //테이블뷰 Row의 높이 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 50; } //테이블뷰 섹션 타이틀 지정 - (NSString *) tableView:(UITableView *)table..