tg2007
tg2007

Reputation: 833

Changing the background Image on a UIButton programmatically

Within my application I am setting up some actions to allow users to create/edit/delete some options via webservices. While allowing to do this, I needed to implement a timer to stop the people from just repeatedly add, delete, add, delete..... When the user presses the button, I call a method like so [sender setBackgroundImage:img forState:UIControlStateNormal]. This appears to work just fine.

When my timer is invalidated after x seconds I am calling another method to restore the background image [changeAdminPinBtn setBackgroundImage:image forState:UI....]. image points to @"button.png" btw.

This above method is not changing my background image back. A property has been declared for the UIButton but cannot seem to find the way of changing the buttons backgroundImage to the image that I want.

The initial UI is wired up in IB and I'm trying to change the properties of these buttons programmatically.

Can someone help shed some light on the issue please?

Upvotes: 0

Views: 1649

Answers (1)

tia
tia

Reputation: 9718

I can think of few things to check:

  1. Function really got called.
  2. changeAdminPinBtn set up and linked to IB correctly.
  3. No other setBackgroundImage anywhere else.

Upvotes: 2

Related Questions