我有点困惑。我试图创建一个自定义单元格,我想使用界面生成器的方式。在UITableView中使用UITableViewCell
我创建一个表正常的方法是有作为表:
.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
还是用整个表上的类/笔尖有是否是UITableViewController?
汤姆
您是否必须将UITableView笔尖的数据源/委托(所以实际表)设置为filesowner仍然? – TMB87
您可以在IB(检查fileowner类设置为AssessList)或代码(在AssessList viewDidLoad中,如下所示:tblAssessList.delegate = self; tblAssessList.datasource = self; – jbat100