iPhone App2011. 7. 25. 18:31

대부분 책들은 UIViewController를 만들지 않고 바로 UITableViewController를 바로 상속받아서 사용하였다.

지금은 UIBiewController 에 여러 컨트롤들과 함께 UITableView를 Insert하는 형식으로 만들어보자.

일단 xib view에 TableView를 하나 만들어서 넣자

@interface DetailView : UIViewController <UITableViewDelegate,UITableViewDataSource>{

   IBOutlet UITableView *descriptionTableView;  

NSMutableArray *data;

}


그뒤 UITableViewDelegate,UITableViewDataSource 프로토콜을 이용하자


- (void)viewDidLoad

{

[super viewDidLoad];

descriptionTableView.delegate = self;

descriptionTableView.dataSource = self;

}


viewdidload에 이렇게 추가하고


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


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


필수 2개 델리게이트를 구현하면 된다 끝~


참고한곳 : http://iwoohaha.tistory.com/156





Posted by 동동(이재동)