Currently I have a grouped tableview with four different custom cells. My last cell needs to be a button but I'm not sure how to implement this correctly. My code is below:
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(0.0f, 0.0f, 300.0f, 50.0f);
[btn setTitle:@"OK" forState:UIControlStateNormal];
[btn setTitle:@"OK" forState:UIControlStateSelected];
[btn addTarget:self action:@selector(onClickRename:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:btn];
I am getting a button to display but I can tell it is not being done correctly because I can see another cell behind it. If anyone knows the correct way to implement this it would be greatly appreciated. Thanks in advance!