I'm trying to change the placeholder text of my chatroom app's textfield every time that the user goes onto the page.
Is there a simple code to access into the placeholder text from inside my ViewController.m file (instead of just changing it from the storyboard drawing board area?)
basically I have a dictionary of values and based on arbitrary conditions I want the placeholder text in the text field to change whenever the user refreshes the tableview.
Do you mean
myTextField.placeholder = #"your placeholder text";
Related
How to add the text on image,and make it dynamic since the user will enter the text in the textfield and while preview of the image it should be as image,where text should appear where the user placed the textfield.
you will simply have to put a label with background clear and add it to the view where image is getting displayed. To make it dynamic, you will have to put up textfield (where user enters text) delegate methods. Once there is any change in the textfield of the user, update the label text.
I want to create a simple calculator application. I know a text field will display the calculations but is there any other way to display the results to the screen. Or increase the text field. I want a larger option.
Thanks
use UILabel instead of a UITextField.
If you need the textfield to show the keyboard you can move your textfield off screen and call [textfield becomesFirstRsponder]; from code.
But I would recommend a custom keyboard anyway.
For simple calculator application you can use UITextField or UIlabel for displaying your result. (Both are use for displaying output)
If you need to display static text with no editing features and no selection features, you should use a UILabel.
If you need selection or editing, use UITextView.
In my project (my first one) I try to assign a text to a textfield created in the Interface Builder.
[date setText:#"2010"];
I also tried using
date.text = #"2010"
I have created the Outlet and don't get any error... the text just doesn't show up.
Just in case it matters...
I prevent the keyboard from showing up and display a calendar instead (works).
Any idea what could be wrong?
Could it be a problem that I'm using delegate methods on the textFields to prevent displaying the keyboard?
If you don't want to edit text using a keyboard, then what is the use of UITextField?
Instead of using UITextField you can use a UILabel (as a global variable) to show the text and use a custom UIButton without a title and use its action for showing the calendar view. You can change the text of the label whenever you want in that class like viewWillAppear or viewDidAppear.
I have a requirement where i need to enter a text in the text field and when i come out of the view and again open the same view where text field is present, i need the text entered earlier need to appear on the textfield(caching) before the user enters the text for the second time.. Please help me..
Does the ViewController of the view containing the textfield get released if you leave the view? Maybe you should hold a reference to this ViewController that it won't be released and therefore your text is still present in the textfield.
i'm having one text field, normally when touch the text field, keyboard will appear, is it any possibilities where when text field is touch one drop down list will appear to recommend value to be enter and value is selected it will appear in texr field
thanks
There's no automatic way of doing it but it is possible.
You would use the textFieldDidBeginEditing: delegate method of the UITextField to display a UIPickerView to your view. (You could also use textFieldShouldBeginEditing: depending on what you wanted to do.) When a user selected an item in the picker, you would add code to copy the appropriate text to the text field and, presumably, hide or delete the picker. You'd also need to hide or delete the picker when the text field lost focus.