What's the difference between:
myBarButtonItem.enabled = NO;
and
myBarButtonItem.userInteractionEnabled = NO;
Does the button become gray each time?
A specialized button for placement on a toolbar, navigation bar, or shortcuts bar. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.1+ tvOS 9.0+
An object that manages image data in your app.
You can set the font size for a specific BarButtonItem by overriding its ContentTemplate. Put an AccessText to this template and set its FontSize property. If you want to change the font size for all items in a specific BarManager, use the attached TextBlock. FontSize property.
There is no way to "hide" a UIBarButtonItem you must remove it from the superView and add it back when you want to display it again. This is actually not true - the method described by Max works well.
From the apple documentation uibarbuttonitem does not posses userInteractionEnabled property.Since it inherits from UIBarItem Class Reference it also does not have userInteractionEnabled property.
And also if you use this line myBarButtonItem.userInteractionEnabled = NO;
your app will crash.
If you dont want your button to get pressed use this:-myBarButtonItem.enabled = NO;
Also see apple documentation.
For the regular Button:-
myButton.userInteractionEnabled = NO; will cause no effect in your image image and you can not press it also.
myButton.enabled = NO; will cause the shadow to come on your button image and you can not press it also.
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