ios - Receiving a UILabel value from a UITextField programatically -


i have uiview supposed act questionnaire form. in view programatically creating dynamic amount of uilabels act questions , uitextfields user puts answers. uiview has button press move on next form.

my question is, lets have 10 questions; meaning 10 uilabels 10 uitextfields in view, there way when user finishes (clicks button), can attain each uitextfield iterate over, uilabel value (indicating question answer)?

a simple solution store each uitextfield pointer key in dictionary uilabel value value, not want use more memory or data structures.

i know when using storyboard can connect labels textfields via outlet.

i tried looking see if uitextfield has hidden variable in can store uilabel value, did not find that.

is there programatical, easy, no additional memory solution this?

you set tag of each label has unique tag , associated text field +1.

or base on frame origin position while you're looping.

or 'hidden' variable route using objc_setassociatedobject


Comments