메뉴 건너뛰기

app

[xcode] tableview 사용하기

박영식2010.09.10 05:41조회 수 6984댓글 2

  • 2
    • 글자 크기

첨부파일은 해당 위치의 정보를 tableView로 보여주는 소스이다.

http://developer.apple.com/library/ios/#samplecode/CurrentAddress/Introduction/Intro.html%23//apple_ref/doc/uid/DTS40009469

에서 받을 수도 있다.


[h파일]


@interface menuTable : UIViewController<UITableViewDelegate, UITableViewDataSource> {

UITableView *tableView;

}

@property (nonatomic, retain) UITableView *tableView;


[m파일]

@synthesize tableView;

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

    return 2;//셀 개수

}


// Customize the appearance of table view cells.

- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

    static NSString *kPlacemarkCellID = @"Cell";

    

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kPlacemarkCellID];

    if (cell == nil)

    {

        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle

                                       reuseIdentifier:kPlacemarkCellID] autorelease];

    }

    

    CGRect frame = cell.textLabel.frame;

    frame.size.width = 200;

    cell.textLabel.frame = frame;

cell.detailTextLabel.text = @"레이블제목";

cell.textLabel.text@"레이블내용";

    return cell;

}

박영식 (비회원)
  • 2
    • 글자 크기

댓글 달기

댓글 2
  • 안녕하세요 ㅠ 현재 공부하는 학생인데요. 이 페이지에서 사용하신 테이블정보를 어떻게 커런트어드레스뷰에서 받아오는지 배울수 있을까 해서요..소소한 소스라도요...찾아보고 공부하는데 위에 이미지처럼 적용이 안되네요 ㅠㅠ
  • 사용한 테이블 정보를 가져오다니.... 무슨 말인지 모르겠군요. 
    음.. 현재 위치 정보를 위와 같은 UI로 보여주는데 적용을 잘 될테고, 이미 적용된 정보를 가져오는 건, PlacemarkViewController.m 부분에서 catch 하지면 될 거 같네요. 내용에 있다시피, 이미 소스는 링크로 공개되어 있습니다.
박영식
2011.09.22 조회 2415
박영식
2011.09.21 조회 2330
이전 1 2 3 4 5 6 7 8 9 10 11... 14다음
첨부 (2)
CurrentAddress.zip
918.0KB / Download 162
tv.jpg
72.8KB / Download 77
위로