I’m an absolute beginner, and I need to have a button to invert two text fields:
text1 <—> text2
- (IBAction)swapText {
name.text = surname.text;
surname.text = name.text;
}
I know that I have to retain the values and then release them, but I’m not sure how to write it.
This is quite simple: the only text / NSString you have to retain is the one that will stop being hold by the
UITextFielditself, namely thename.textthat you will replace bysurname.text.