I have an UIButton
placed with constraints. In the interface of the view controller I created an IBOutlet
for the height constraint of the button. In viewDidLoad
method I have the code:
myButtonConstraint.constat = 0; [self.view layoutIfNeeded];
In viewWillAppear
the height of the button is 0, but on the simulator the title of the button is still visible. Even though the title of the button is visible, the button is not tappable, it performs no action.
What is going on?
You can check Clip Subviews
on interface builder or if you want do it by code try this:
myButton.clipsToBounds = YES
from apple documentation:
clipsToBounds
A Boolean value that determines whether subviews are confined to the bounds of the view.
@property(nonatomic) BOOL clipsToBounds
Discussion
Setting this value to YES causes subviews to be clipped to the bounds of the receiver. If set to NO, subviews whose frames extend beyond the visible bounds of the receiver are not clipped. The default value is NO.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With