-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