use*_*859 0 iphone uibutton uitableview
在阅读了这里和其他地方的所有示例之后,我编写了以下代码来向UITableViewCell添加一个按钮,但我无法在单元格中显示它.我究竟做错了什么?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   static NSString *CellIdentifier = @"Cell";
   UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
   if (cell == nil) {
       cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
   }
UIButton *cellButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[cellButton setFrame:CGRectMake(0.0f, 5.0f, tableView.frame.size.width-2, 44.0f)];
[cellButton setTitle:[aList objectAtIndex:indexPath.row] forState:UIControlStateNormal];
[cell.contentView addSubview:cellButton];
[cellButton release];
return cell;
}   
谢谢,约翰
| 归档时间: | 
 | 
| 查看次数: | 1636 次 | 
| 最近记录: |