본문 바로가기 메뉴 바로가기

권말련의 게임 블로그

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

권말련의 게임 블로그

검색하기 폼
  • 분류 전체보기 (1337) N
    • 로스트아크 (574)
      • 대항해 (126)
      • 모험의 서 (75)
      • 모코코(대륙) (119)
      • 기억의 오르골 (18)
      • 업적 (27)
    • 게임 (472) N
      • 엘든링 (151)
      • 마비노기 모바일 (7)
      • 오버워치2 (23) N
      • 포켓몬고 (26)
      • 팰월드 (21)
      • 디아블로4 (43)
      • 마인크래프트 (4)
      • 몬스터 헌터 와일즈 (1)
      • 오딘 (22)
      • 아이온 클래식 (75)
      • 바람의 나라:연 (24)
      • AFK아레나 (45)
      • 배틀그라운드 (2)
      • RPG게임 (7)
      • 리니지TL (2)
      • 모바일게임 (17)
    • 모바일게임 쿠폰 (8)
    • IT (201)
      • iOS (67)
      • Android (38)
      • PHP + Mysql (7)
      • AWS+Window Server (5)
      • 블로그 (32)
    • 일상 (76)
      • 맛집 (8)
      • 운동 (15)
      • 여행 (4)
      • 리뷰 (9)
  • 방명록




티스토리 뷰

IT/iOS

UITableview 기본 메소드

권말련 2012. 5. 22. 09:03

 

tableview 사용된 프로젝트

//테이블뷰 섹션의 수

- (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 *)tableView titleForHeaderInSection:(NSInteger) section {
     return @"스텐스";
}

//테이블뷰 섹션의 높이

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 36;   
}
//테이블뷰 Footer의 높이
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
        return 39;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    //코드 작성
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {

//코드 작성

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   
    static NSString *CellIdentifier = @"Cell";
    //커스텀 셀 사용
    NewsCus *cell = (NewsCus *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        // cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault         reuseIdentifier:CellIdentifier] autorelease];
        NSArray *arr = [[NSBundle mainBundle] loadNibNamed:@"NewsCus" owner:nil options:nil];
        cell = [arr objectAtIndex:0];
       
    }
   
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
   
    DetailArticle *detailViewController = [[DetailArticle alloc] initWithNibName:@"DetailArticle"     bundle:nil];
    [self.navigationController pushViewController:detailViewController animated:YES];
   
    }
}


테이블뷰 사용시 기본적으로 사용되는 메소드들. 테이블뷰는 가장 흔하게 사용되는 함수로 리스트 형식으로 데이터를 보여줄 때 사용된다.

프로젝트 할때마다 쓰는데.. 테이블뷰의 세계는 끝이 없는 것 같다  

반응형
그리드형

'IT > iOS' 카테고리의 다른 글

iOS5 Automatic reference counting  (0) 2012.06.19
Custom Actionsheet (커스텀 액션쉬트 이미지 넣기)  (0) 2012.06.14
앱에서 다른 앱 호출  (0) 2012.06.13
View Animation (뷰 애니메이션)  (0) 2012.06.12
Couldn't register com.yourcompany with the bootstrap server. Error: unknown error code.  (0) 2012.05.24
UITextView 줄바꿈  (0) 2012.05.23
MAC에서 특수문자(Special Characters) 입력  (0) 2012.05.23
UITableView cell 추가 및 삭제  (0) 2012.05.23
  • 카카오톡 공유하기
  • 네이버 블러그 공유하기
  • 페이스북 공유하기
  • 트위터 공유하기
  • 구글 플러스 공유하기
  • 카카오스토리 공유하기

댓글
반응형
공지사항
최근에 올라온 글

Blog is powered by Tistory / Designed by Tistory

티스토리툴바