Change image of iOSToolButton

I want to change the image of a iOSToolButton on a Toolbar during runtime from one image to another.

I tried the following:

Dim button As iOSToolButton

'this create the button with an image
button = iOSToolButton.NewPlain(imSearch)

'the image of the button is blank
btnFilter.Image = imSearchActive

imSearch and imSearchActive are both images which are images in the application.

I not understand why the button is blank, after I set the image with “button.image”.

I do not remember why but changing the image at runtime doesn’t work.

First of all I always set a tag to iOSToolbuttons, that helps in managing them.

Then you can use this code to replace a button:

[code]For i As Integer = 0 To Me.RightNavigationToolbar.Count-1
If Me.RightNavigationToolbar.Value(i).Tag = “theTagYouAreLookingFor” Then

Dim tb As iOSToolButton = Me.RightNavigationToolbar.Value(i)

tb = iOSToolButton.NewPlain(newImage)
tb.Tag = "theTagYouAreLookingFor"
Self.RightNavigationToolbar.Insert(i, tb)

exit for i

End If