I put it in a function, which will trigger when button is clicked. It can run the program, but it doesn't change the text. Oh yeah, thats a warning to that line of code:
"UIButton" may not respond to "-setTitle:forstate"
And forgive me, I wasn't clear on my question, what I meant is when I clicked the button, the text will be changed permanently... Is that possible to do that? The codes in the header files doesn't look like doing this kind of thing...
I also found this in the future, but I'm going to have to bring the past back to life because it didn't work for me
I've made a simple stopwatch with a start/stop button, and what i'm trying to do is change the stop button to stay "reset" after it's clicked once, and revert back to "stop" when the stopwatch is running.
The solution in this thread is pretty much exactly how I'd written my code. I defined an IBOutlet UIButton in my header file. I hooked up the outlet in interface builder. And in a few places in the code I call setTitle and pass it UIControlStateNormal, because I just want it to change the normal non-highlighted/selected state.
It's not working and I really have no idea why. Something that did occur to me as I was writing this is that I did set the initial title for the button in interface builder. Could that have something to do with it?
Anyways, sorry to resurrect a dinosaur, but this seemed a good place to post my problem.
For some reason I had set the button = nil in my viewDidLoad method. I think I had done that and then had some configuration of the button properties after that at one point and I deleted the properties and just set the title and font and all that in interface builder, but apparently I didn't delete the "buttonName = nil" part.
So yea, message to all you future searchers...don't set your buttons equal to nil