TMB*_*B87 0 iphone xcode uitableview ios
我对某些东西感到困惑.我正在尝试创建一个自定义单元格,我想使用界面生成器方式.
我创建表的正常方法是将表作为:
.H
@interface AssessList : UIViewController {
    IBOutlet UITableView *tblAssessList;
}
@property(nonatomic, retain) UITableView *tblAssessList;
@end
.M
- (NSInteger)
numberOfSectionsInTableView:(UITableView *)tableView {
    return groupArray.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
     return totalArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }
    cell.textLabel.text = @"I am the text....";
        return cell;
}
现在我已经为单元格创建了一个新类,我想我知道如何将它放入.但是我可以将.h保留为
@interface AssessList : UIViewController
或者带有完整表的类/ nib是否必须是UITableViewController?
汤姆
带有完整表的类/ nib必须是UITableViewController吗?
不.A UITableViewController只是一个便利UIViewController子类,它有一个UITableView并且已经被设置为它的委托/数据源(它被声明为符合UITableViewDelegate和UITableViewDatasource协议),它还在模板实现文件中为这些协议预先填充了方法实现Xcode为你生成.你也可以自己做所有这些,我经常这样做.   
但是,您应该为UITableViewCell创建一个IBOutlet,以便可以从nib文件加载它(请参阅表视图编程指南中的从Nib文件加载自定义表 - 查看单元格).
| 归档时间: | 
 | 
| 查看次数: | 415 次 | 
| 最近记录: |