I have to create a button programmatically, and set an image background at that button. There is one condition, I want to hide that button and show a UITableViewCellAccessoryDetailDisclosureButton, but I don’t know how.
The button is still visible and the UITableViewCellAccessoryDetailDisclosureButton falls on it.
Here is my code:
if (filemodels.fileType == @"project" && filemodels.fileExpanse == @"none") {
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
NSLog(@"open expanse");
//[displayBut isHidden];
//displayBut.hidden = YES;
//[displayBut setImage:nil forState:UIControlStateNormal];
displayBut.alpha = 0.0;
}
Can anyone help?
Update:
Regarding Vladimir‘s answer. I have changed it as per his suggestion, but the button is still not hiding.
The code is like this:
if ([filemodels.fileType isEqualToString:@"project"] && [filemodels.fileExpanse isEqualToString:@"none"]) {
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
[cell.contentView addSubview:nil];
[displayBut setHidden:YES];
[displayBut setBackgroundImage:nil forState:UIControlStateNormal];
}
[Merged update/question as answer into OP]