Reputation: 26556
I have been told that to access a UITextField
in the setup i have with my app, i have to use a subView
whatever this is (in a noob at objectivec) and i was given this
[subview isKindOfClass:[UITextField class]]
Where do i put this? And how can i use it to set the value of my UITextField
? :D
Thanks!
Update: I want to set the value of my textfield, in the function that is called after my URLScheme - the scheme bit works as i have alerted out the url.. this is cool, now i need to set a textfield with a string?
Upvotes: 0
Views: 4309
Reputation: 24964
Iterating through subviews and choosing based on type is not generally considered good design practice. You should reconsider how this is structured to have explicit access to the UITextField
you want to access. Doing this with Apple's private classes in particular will deny you access to the App Store. At any rate, here's how you'd do what you want:
for(UIView *subview in myParentView){
if([subview isKindOfClass:[UITextField class]])
[(UITextField *)subview setText:@"MyString"];
}
Upvotes: 3
Reputation: 1866
This is still very little useful context, but you most likely want to create an outlet to your text field and just set the value using that reference (with the text property).
Upvotes: 0