Getting a variable into another class through properties or button tags with Iphone SDK?

Posted by MarcZero on Stack Overflow See other posts from Stack Overflow or by MarcZero
Published on 2010-03-23T23:58:34Z Indexed on 2010/03/24 0:03 UTC
Read the original article Hit count: 365

Filed under:
|
|

Hello. I have been pounding my head against a wall trying to figure out what I think is a simple thing to do, but I have, so far, been unable to figure it out with the iPhone SDK. I have a view with 4 buttons. When I push the buttons, I have another view called and come up to take over the screen. I want to have a simple variable passed from the old view to the new view. The purpose of this is to know what button was pressed out of the four identical ones. (trying to get an int value of 1 through 4) Here is what I have tried so far:

I initially tried to call the variable from the class itself. My understanding was that my new view was only sitting on top of the old view, so it should not have been released. I could not get access to the variable as the variable was said to not be declared.

I then tried to create a method that would return the int value. Again, the view class was not seen and was being declared as a "first use" of it.

I then attempted to follow another similar post on here that suggested to try and send the button tag number to some part of the new view. I attempted to do this by setting the new views button title but I still cannot figure out a way to code it without coming up with errors.

I am just looking for what method would be the best for me to pursue. I have no problem going back and reading the books on Objective-C, but I'm just trying to figure out which way I should concentrate on. Thank you for any insight.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about methods