-1
我想要具有不同名稱的表格單元格,但到目前爲止他們都具有文本'1'。 如何使單元格具有唯一的名稱,如tableData數組中所述?obj c表中不同的表格單元格名稱
- (void)viewDidLoad {
[super viewDidLoad];
// self.clearsSelectionOnViewWillAppear = NO;
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
tableData = [NSMutableArray arrayWithObjects:@"1", @"2", @"333", nil];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section {
return [tableData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"subTable"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CELL"];
}
cell.textLabel.text = [tableData objectAtIndex:0];
return cell;
}
聽說我可能需要使用'forIndex'或'indexPath'或其他一些方法嗎?