I'm making an app and trying to learn about Xcode and objective C but just need some help with understanding something.
I'm looking at examples and uses of delegates, particularly in respect to UITextfields (seems like a good place to start).
I've found a delegate function textFieldDidEndEditing: and learnt how to use it. If I have a text field and want to do something to the number (e.g. have a % sign next to it), i put that code in the block with the delegate function (in my .m file), change the delegate of the text field the file owner and it all works perfectly.
What if I have a second text field and I want to use textFieldDidBeginEditing: delegate function and I want it to return say an * when I finish editing instead of a %?
How can I have 2 instances of the same delegate functions but for different textFields? How do I differentiate? Do I have to use 1 instance of textFieldDidBeginEditing: but use an if function within it which determines what to do depending on the textfield?
Any clarification on this situation would be great, thanks.
I'm looking at examples and uses of delegates, particularly in respect to UITextfields (seems like a good place to start).
I've found a delegate function textFieldDidEndEditing: and learnt how to use it. If I have a text field and want to do something to the number (e.g. have a % sign next to it), i put that code in the block with the delegate function (in my .m file), change the delegate of the text field the file owner and it all works perfectly.
What if I have a second text field and I want to use textFieldDidBeginEditing: delegate function and I want it to return say an * when I finish editing instead of a %?
How can I have 2 instances of the same delegate functions but for different textFields? How do I differentiate? Do I have to use 1 instance of textFieldDidBeginEditing: but use an if function within it which determines what to do depending on the textfield?
Any clarification on this situation would be great, thanks.