Friday, November 1, 2013

UITableViewのメソッドとか

UITableViewControllerを使わないでUITableViewを使いたいてのはよくあると思うけど、よくテーブルビューのためのメソッド一覧を忘れてしまうのでその一覧。
僕が比較的よく使うやつ。
//table delegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 100;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [[UITableViewCell alloc]init];
    
    static NSString *CellIdentifier = @"OneQuestion";
    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    return cell;
}

-(void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath{

}

-(void)scrollViewDidScroll:(UIScrollView *)scrollView {

}

No comments:

Post a Comment