Okay, so I'm plugging along programming a small iPhone application that is simply an exercise focusing on class inheritance. I created a player class with a few methods and member variables. I created a child class to inherit from the parent "player" class. All is right in OOP world, when all of a sudden WTF?!?!?!
I can't update the text of a UITextField object named txtHP. Huh? I poured over the code and found nothing syntactically wrong, and neither did XCode. I create a 5 character object name by adding the character '1' to the end of txtHP, making it txtHP1 and WTF?!?!?!? It worked! The text content updated as I had intended.
I approached the issue from a syntax or logic error perspective first. I should have gone away from focusing on that one UITextField object to look at the other objects first; I didn't check "off axis" until I had completely exhausted the syntax angle for that one object. I detected the anomaly when I replaced the variable txtHP with another UITextField object named txtFacing and was able to output the data I needed. I decided to append '1' to the end of UITextField txtHP and the code executed perfectly. I'm not sure I'll have time to plumb the depths of the interwebs (;-) for an explanation as to why an XCode UITextField IBOutlet needs to have more than 4 characters in its name... any ideas?
No comments:
Post a Comment