I'm having problems adding buttons to the content view of a UITableViewCell. The button is not visible. But, when I click on a cell and when it is selected (using bluebackground by default), the button may be visible.
The table view controller is created using initWithStyle:UITableViewStyleGrouped
.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UIButton *theButton; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; theButton = [[UIButton alloc] initWithFrame:CGRectMake(800, 25, 32, 32)]; [cell.contentView addSubview:theButton]; theButton.tag = 1; [theButton release]; } if(indexPath.section ==0){
source share