asedra_le
asedra_le

Reputation: 3067

Can i link an NSMutableString to an UITextField?

I have one NSMutableString and one UITextField. I want my NSMutableString automactic update it's value (set NSMutableString = UITextField.text) when UITextField.text change. Can i do it?

Upvotes: 0

Views: 518

Answers (1)

donkim
donkim

Reputation: 13137

You could subclass UITextField and add that NSMutableString as a property. You would override UITextField's setText: method, call [super setText:aString]; and then set that NSMutableString property.

If the NSMutableString is in another class, you could still do something similar. Instead of setting the value of NSMutableString in setText:, you would specify a delegate for the class and call the delegate with the updated string value.

Hope this helps!

Upvotes: 1

Related Questions