iOS Question Top Right Button enable/disable programmatically


Active Member
Licensed User
Hi Guys
I am trying to enable/disable one of the Top Right Buttons programmatically (or show/hide it if can't be enabled/disabled).
Can someone give me a few pointers (lets say I want to disable button #1 then re-enable it).

Kind regards
Dave Morris

Semen Matusovskiy

Well-Known Member
Licensed User
Page1.TopRightButtons is a List of BarButtons. You can recognize BarButton, for example, by Tag property.
For Each b As BarButton In Page1.TopRightButtons
   If b.Tag = "..." Then  b.Enabled = False ' Or True
In addition you need to think about 'enabled/disabled' colors.
For example, you use Erel's CreateFABarButton from
b.InitializeCustom (...) sets a color for normal and highlighted states only.
So, you need to add something like this
Dim no As NativeObject = b
no.RunMethod ("setTitleColor:forState:", Array (no.ColorToUIColor (Colors.LightGray), 2))
Upvote 0