How To Put A UITextField In A UIAlertView
Uploader Comments (XcodeMod)
All Comments (17)
-
Question, now that you typed in the text in the alert, how can I access that value now after I hit ok?
-
I think you should also release myTextField.
-
What happened when you rotate the simulator.. your code will not work. it tried with iPhone 3.0 version and i managed it once you rotate the simulator then keyboard you can hide by clicking on Done button.. but the same code do not work for iPhoneOS4.0
-
Let's say the textfield instide the alert view is named "textfield1". In your original view you have a uilabel named "label1." the code is pretty much: label1.text = textfield.text." place this code where you have the code for when one of the buttons on the alertview is. There are some videos on youtube on how to set the actions of an alertview.
If this is confusing, I can upload some code that I have and send you the link. Message me if you want me to do this.
-
haha wanna tell me? or link me to where you saw it?
-
@taimur38 yea... it's a little complicated if you haven't used xcode frequently
-
Did you ever get an answer for this?
I'm fairly new to xcode, but you didn't put any of that into the .h file. Is that because you used only the built in methods?
brianmcgoangill 4 months ago
@brianmcgoangill putting stuff in the .h file is needed if you need it over several methods
or if you need to connect it in your interface builder
XcodeMod 4 months ago
How do you use the text they enter into the textfield?
iminichrispy 2 years ago
@iminichrispy then you need to add the definition of a textfield to your .h file, then call it just like you would use it in any other UITextField
XcodeMod 4 months ago