0

everybody knows the button in the app store, that says "buy" and when you bought it it changes to "download". I want to have a similar button with "download" and "delete". But I couldn't figure it out how to create it. The methods aren't the problem, but how do you configure the button?

I thought it should look after the data, if its stored the button shows "delete" and calls the delete method when clicked, otherwise the download method is called while the button says "download". Can somebody give me an advice?

Do I need "awakeformnib" ? There should be a research for the file before the buttons are initialized as well as a dynamic changing while the user uses the buttons.

hope somebody can help me :-)

J. Steen
  • 15,470
  • 15
  • 56
  • 63
Julian Herbold
  • 537
  • 9
  • 20

1 Answers1

0

When I need such thing, I just create 2 different buttons with the same frame, only one of them is visible at a time. In their methods I not only do the things that stand for that button but also hide/show them.
So I think you could do the same - first check the data, config the first button, and then just hide/show another one.
Hope this helps.

Polina
  • 273
  • 4
  • 13
  • thanks for that idea! but isn't there a more comfortable way to do the same? – Julian Herbold Sep 21 '12 at 13:25
  • As for me it is one of the easiest ways. So if you find something more comfortable, share it, please :) – Polina Sep 24 '12 at 15:44
  • i did it programmatically. i got a method to change the title if theres the data or not, it is called in the view did load as well as in the ibaction. the 2 different methods are delegated by an if clause ;) – Julian Herbold Sep 25 '12 at 13:58