Questions tagged [uitextfield]

1

votes
3

answer
21

Views

I want to use it as a UIButton when I tap UITextField

I created a custom keyboard screen on tvOS. If possible, tap on UITextField as it is, I want to transition to the custom keyboard view. But tapping the UITextField always displays the system keyboard. What should I do now?
flyoo
1

votes
1

answer
1.3k

Views

How to add UIActivityIndicatorView as UITextField’s rightView

To make the UIActivityIndicatorView the left view, all I do is searchField.leftView = self.progressIndicator; but if I change leftView to rightView then the indicator does not show. How might I fix this problem?
Katedral Pillon
1

votes
3

answer
365

Views

How to disable UIAlertAction depending on UITextField?

I have an action that creates an alert when the button is tapped. This alert consists of two textfields and two actions (add and dismiss). Is there any simple way for me to disable the add button if the textfields are empty (I'll later check if the second one is really an URL but let's keep things f...
Wizzardzz
1

votes
3

answer
220

Views

Subclassing UITextfield in Swift

I am currently initializing quite a few properties in my view controller, but it just feels very, very messy. I have been creating UITextField like: lazy var passwordTextField: UITextField = { let textField = UITextField() let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 30)) t...
butter_baby
1

votes
2

answer
41

Views

Checking if first 3 characters of UI TextField are numeric in Swift

I want to check if the first three characters entered in the UI Textfield are numbers. I could do this easily in Python, but for some reason in Swift it's a pain. Here's my python if statements (which I want to 'translate' into swift as it works): str = '123abc'...
Michael Manfield
0

votes
0

answer
6

Views

button image is not show in rightView of UItextfield

I have created a button image and placed it on the rightView of a UITextField 'password' using Sa wift. I want to create toggle button hide/show secure text in the password field. The image shown on the right view. Code: func passwordToggleButton(){ let button = UIButton(type: .custom) button.setIma...
NinjaDeveloper
1

votes
2

answer
323

Views

UITextField without get property swift 4

I have custom control which contains textField. Sample code looks like this: @IBDesignable class MyTextField: UIView { private var _text: String? private var textField: UITextField? @IBInspectable var text: String? { get { return _text } set (newValue) { guard let txt = newValue else { return } self...
emerog
1

votes
0

answer
104

Views

UITextfield respond return UIViewNoIntrinsicMetric

I've added a UITextfield to a view, but when i run the app and press the textfield i get following error: error: returned 0 width, assuming UIViewNoIntrinsicMetric What causes this to happen? Custom UIView Code let rightBottomView = UIView() rightBottomView.isUserInteractionEnabled = true rightBot...
Peter Pik
1

votes
2

answer
75

Views

Selecting calculation based o which textfield is left blank

I am trying to make a code (in Swift 4 xcode 9) that uses 3 variables, 2 of which are given by the user via textfields. The value of the other variable will be calculated based on which variable was left blank. For example, if the user leaves textfield1 blank, the inputs from the textfield2 and text...
Carlos Gomes
1

votes
0

answer
217

Views

How to achieve like “LINE” input UITextView adding Tokens by Swift?

Sorry, I'm beginner of Swift. I have a question about inputView of Chat App. How to add the tokens(tags) like 'LINE' and separate normal string? First, I use the UITextView and add the tagView on it, but I failed. Does anyone know how to do like in the following image? Or is this using the UIScrollV...
JimmyLee
1

votes
0

answer
34

Views

UITextField keyboard pop up after api response received

In my app am using UITextField in the login screen. To get the login details I connect the app to server through API. While calling the api I display an activity UIActivityIndicatorView. Before calling the api I do end editing. once the response is received from server again the keyboard is pop up w...
AJ Sanjay
1

votes
1

answer
43

Views

How to save textField.text data and persist them when moving between view controllers?

I have built a multi-step sign up with 3 different view controllers. VC1: Email, pass, confirm pass text fields then press next to VC2 VC2: First, middle, last name then press next to VC 3 VC3: Address, city, state, zipcode -> Complete sign up. I would like to know how I can persist the textField.te...
alwongg
1

votes
0

answer
122

Views

Issues with clearButtonMode, showing button for empty text

How do you get the clear button to appear on a UITextField when the placeholder is visible? The following works but is only visible when selected and text has been entered. Clear Button (when text entered) textField = UITextField(frame: someFrame); textField.placeholder = 'Untitled'; textField.clear...
J-Dizzle
1

votes
1

answer
42

Views

How do you correctly implement the function for shifting UITextFields above the users input, when it obscures the UITextField?

Upon finding Apple's documentation for UITextFields, I stumbled upon this article which details how one can make it so that a UITextField, housed within a UIScrollView, can be shifted upwards so that the user can view their input. However, whenever I try to implement this, the behaviour is never as...
1

votes
3

answer
68

Views

How can I retrieve the data from a text field that is embedded in a UITableView in Swift?

I've been trying to create a submission form of sorts in a UITableView (i.e. a table view which has a text field in each row), but haven't been able to retrieve the user input from the programatically generated text fields in the table view. This is the code so far: class VC12: UIViewController, UIT...
cybertortoise
1

votes
1

answer
27

Views

How to acces textfield values inside tableview cell when using TPKeyboardAvoidingTableView

I have integrated TPKeyboardAvoidingTableView to handle next responder of textfields. How can i access textfield values as i cannot assign textfield delegates. func textFieldDidEndEditing(_ textField: UITextField) { if textField.tag == UserDetails.Name.rawValue{ name = textField.text! print(name) }...
Jane
1.6k

votes
30

answer
603.9k

Views

How can I make a UITextField move up when the keyboard is present - on starting to edit?

With the iOS SDK: I have a UIView with UITextFields that bring up a keyboard. I need it to be able to: Allow scrolling of the contents of the UIScrollView to see the other text fields once the keyboard is brought up Automatically 'jump' (by scrolling up) or shortening I know that I need a UIScrollVi...
1

votes
1

answer
46

Views

Populate UITextField by fetching a Core Data string

I'm trying to populate a UITextField with data from a selected cell. When the table is populated, I use the array var intentionsArray: [EIntentions] = [], where EIntentions is my entity in Core Data. Whenever I try to set my text field to a specific index path value in the array, I get an error with...
Anthony DeFallo
1

votes
2

answer
284

Views

UIPickerView selectedRowInComponent:0 always return zero first when I try to set data in second component

I'm new to iOS programming. Recently, I'm trying to make a UIPickerView as an inputView in UITextfield. The data in UIPickerView is about all the iOS built-in fonts. So I want to make two components in UIPickerView: the first is familyType, and the second is all the fonts in that familyType. I simul...
Leo Liu
1

votes
3

answer
42

Views

UITextField display editing when activity stopped

In my application login screen I use text fields to get the login credentials and through API I receive the data. While performing the API call with activity indicator I do end editing from the view controller like [self.view endEditing:YES]; I am facing an issue with this, before the API call endEd...
AJ Sanjay
1

votes
2

answer
72

Views

Alternative ways for handling keyboard dismissal when either child or parent view controller is tapped?

I have a child view controller that has a UITextField. I also have a parent view controller in which I add a child view controller. The child view controller takes up about half of the parent view controller. self.childVC = ChildViewController() self.childVC.delegate = self func addChildViewContro...
LC84
1

votes
4

answer
141

Views

How to update label from UITextField on press of button

So I know this might be an easy thing to do, but I am beginning with swift for macOS and swift development. I want to make a simple app that asks for a name, then says 'Hello, name'. In macOS development a way to do this is by doing this: @IBOutlet weak var nameField: NSTextField! . // More code her...
M.Soto114
1

votes
0

answer
350

Views

UITextContentType* not working

I am using UITextContentType GivenName/FamilyName on UITextfield subclass to allow user to quickly fill up their personal details in sign up form. For some reason when ever user tap on the suggested name in suggestion bar above keyboard, it is not filling up the textfield. Instead it is filling the...
Piyush Hirpara
1

votes
1

answer
205

Views

UITextView not becoming first responder for iphone X ios 11

textview isn't becoming first responder when using iphone X but it works fine for iphone 7 and other devices. I have set the delegate for the textview and use textViewDidBeginEditing delegate method. Any ideas? Thank you! descTextView.delegate = self func textViewDidBeginEditing(_ textView: UITextVi...
mir
1

votes
2

answer
108

Views

Hide the autocomplete Tableview when text field is empty

The following code will generate a custom autocomplete Table View autocompleteTableView below my text field txtActivity. How do I hide the Table View when text field is empty. - (void)viewDidLoad { [super viewDidLoad]; self.txtActivity.delegate = self; [self cofigureAutoComTableView]; } - (BOOL...
Hanz Cheah
1

votes
1

answer
48

Views

Objective C - UITextFieldTextDidChangeNotification not responding to correction selection

In my app, I have a simple textfield set up for the user's zip code while registering: I am listening for changes to the textfield as so: [self.zipCode addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; However, if the user begins typing and their ZI...
Adam G
1

votes
1

answer
1.5k

Views

How do I scale individual TextMesh Pro Text Objects in a Vertical Layout Group evenly?

Unity Version: 5.6.5f1 Personal TextMesh Pro Version: 1.0.56.0b3 I am attempting to create dynamic TextMesh Pro text blocks that are stored in a Vertical Layout Group UI Element. Each block of text is stored in its own gameobject, and all gameobjects are children of the Vertical Layout Group. All Te...
Katherine Cykes
1

votes
2

answer
286

Views

Tapping outside a UITextField to stop editing

When I tap outside my UITextField to clear it's content and hide the keyboard it reacts as if I hit return and triggers actions associated with hitting return. It seems pretty counterintuitive to me. The textField cleared and keyboard dismissed I want, but not amountEntered(_:) called.. I want to b...
Wizzardzz
1

votes
5

answer
125

Views

UITextField - Scroll down when return

I have multiple text fields on a view controller, and have implemented the textFieldShouldReturn function so that when I hit return, it goes to the next text field. However, right now the screen stays the same, so the active text field is covered up by the keyboard. How can I make it so that the scr...
user3628240
1

votes
0

answer
39

Views

Char difference between UISearchBar and UITextField

I'm using AFNetWorking POST request to send strings typed by users to my server. Depending on where the string is caught from, the chars used don't seam to be the same. For exemple, the simple quote EDIT: apostrophe used by a UITextField is ' and the one used by UISearchBar is ’ As result, my...
zbMax
1

votes
4

answer
84

Views

Move Keyboard Up Issue on iOS 11 iPhone 6 are earlier model

I'm using below method to move my 'UITextView' up when user clicks on it. But this works on iPhone 7 and iPhone X but when I tried it on iPhone 6, 5s then textView didn't move up. Please help me with correct way to move keyboard up. extension UIViewController { func startAvoidingKeyboard() { Notifi...
NITESH
1

votes
2

answer
229

Views

How to edit or update the text inside the Text Field in Swift?

Here is the .gif of this screen : http://g.recordit.co/73jHPP5LE6.gif As you can see in the picture above there is an UILabel Rp '25.000.000' and a text inside the TextField '25000000' (after the user fill the text field). Both of them is actually a currency. I want to edit the text inside the Textf...
Alexa289
1

votes
0

answer
53

Views

keyboard covering the textfields in subview

I have a view which contains 4 textfields and a button .. this view is not the main view .. the problem is that the keyboard covers the textfields down and the button! i tried this code but its not working: // Move the text field in a pretty animation! func moveTextField(_ textField: UITextField, m...
mrs.tat
1

votes
1

answer
147

Views

How to set pickerView and Keyboard for one textField

This is my first app. I have two text fields one for selecting Projects and second for selecting Tasks. If I select one project from the 1st text field and its showing related tasks in the 2nd text field. If task array is empty, then I have to show keyboard for entering some text for input to the 2n...
Appu Y
1

votes
1

answer
27

Views

Views alpha and frame property spoil when UITextFields first responder changes

I have a view (Lets called thirdStackView) and two textfield (Lets called them textfield b and c). In my viewdidload, I give their anchors and make textfields alpha to 0, also y frame of textfields to -100. With a button tap, I move thirdstachview out of screen with an animation and make textfields...
Emre Önder
1

votes
0

answer
33

Views

UITableViewController does not scroll correctly with a container view

I have a UITableViewController with 3 static cells. The second one is a container view. This container view is a UIViewController form with some UITextField's. When I touch any of UITextField's it does not scroll to the right position, above the keyboard and in the visible area. Every textfields go...
1

votes
2

answer
30

Views

How to leave only the lower border of UITextField?

It is necessary to leave only the bottom border at UITextField. For some reason my code does not work. let bottomLine = CALayer() bottomLine.frame = CGRect(x:0.0, y:1.0, width: myTextField.frame.width, height: myTextField.frame.height - 1) bottomLine.backgroundColor = UIColor.white.cgColor myTextFi...
Sergey Verigin
13

votes
10

answer
28.2k

Views

Formattting Phone number in Swift

I'm formatting my textfiled text once the user start typing the phone number into this format type 0 (555) 444 66 77 and it is working fine but once I get the number from the server I get it like this 05554446677 So please could you tell me how I can edit it in the same format once I get it fro the...
CAN
1

votes
2

answer
68

Views

UITEXTFIELD input data to alert box ok clicked

I am implementing a user form and getting details from user, after filling all the fields when the user press the SUBMIT button alert box is created (The alert box is kind of Terms and condition) when the user Agree to it. It must take all the UITextField input data. I have created a class and in th...
1

votes
1

answer
57

Views

Capture iOS 3D Touch cursor

In iOS when you 3D Touch on the iPhone keyboard it allows for moving the cursor around the text field. I would like to build a text field from scratch and have similar feature. Is it possible to capture this event?
Tobol

View additional questions