-viewDidLoad {
tbl.rowHeight = 150;
ary = [[NSArray alloc]initWithObjects:@"asdf",@"asd",nil];
ary2 = [[NSArray alloc]initWithObjects:@"google",@"yahoo",nil];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [ary count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
cell.textLabel.text = [ary objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [ary2 objectAtIndex:indexPath.row] ;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
对我来说问题是detailtextlabel在表格视图中不显示。我的代码中是否有错误?标签不显示在UITableView中
这应该是一票关闭为重复,不是一个答案。 – Mac 2013-05-23 23:08:05