Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

medasmx

macrumors member
Original poster
I am going through the iphone book by Mark and LaMarche, and cannot understand one segment of code. It involves the following...

Code:
NSNumber*tagAsNumber=[[NSNumber alloc]initWithInt:textFieldBeingEdited.tag];
[tempValues setObject:textFieldBeingEdited.text forKey:tagAsNumber];

Here is what I don't understand. It looks like you are creating a tag for the text field in the first statement. The second statement generates a key and value, using the number (tag) as the key. "tempValues" is an NSDictionary. I don't understand how the number is generated in the first statement, what that number is, etc. This code is in chapter 9 of the Mark book.

Any help or reference is appreciated.

Adam
 
Before asking questions your first stop should be the documentation. The rag property of a UIView is well documented.

Unless set otherwise all UIViews have a tag of 0. It is a programmer-defined identifier that can be later used to identify/retrieve specific views. I assume that you missed a step somewhere earlier in the book where the tags were set.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.