uitextfield

How do I check UITextField values for specific types of characters e.g. Letters or Number?

筅森魡賤 提交于 2020-01-02 13:18:25
问题 What I want to do is set some boolean in the if statement below to true if anything other than letters, numbers, dashes and spaces is contained in the textField. Then for an email field check for a valid email. This is how I'm checking for length: if countElements(textField.text!) < 2 || countElements(textField.text) > 15 { errorLabel.text = "Name must have between 2 and 15 characters." self.signUpView.signUpButton.enabled = false } else { errorLabel.text = "" self.signUpView.signUpButton

Tapping between UITextFields in iOS7

杀马特。学长 韩版系。学妹 提交于 2020-01-02 08:47:31
问题 When a UITextField is selected and has a keyboard shown, if I tap other parts of the view the keyboard disappears. If I tap another UITextField , the keyboard stays up, the first textfield is deselected, and nothing happens. Then I need to tap on the other UITextFIeld again for selection to happen and a keyboard to appear. Is there a way to make a second UITextField immediately accessible when a first UITextField is selected? 回答1: If you reload the tableview in textFieldDidEndEditing , you'll

becomeFirstResponder on UITextView not working

坚强是说给别人听的谎言 提交于 2020-01-02 08:12:33
问题 For some reason, I'm having trouble with making a textfield the first responder. I have a UITableView with two rows. Each row has a label and a UITextField. The textfields are tagged kLoginRowIndex = 0 and kPasswordRowIndex = 1. As you might have guessed, I use this for setting login and password. If the user taps on the return button when editing the login textfield, I want the password textfield to get the focus. Unfortunately, the password textfield doesn't accept the focus. Here is my

becomeFirstResponder on UITextView not working

你说的曾经没有我的故事 提交于 2020-01-02 08:11:51
问题 For some reason, I'm having trouble with making a textfield the first responder. I have a UITableView with two rows. Each row has a label and a UITextField. The textfields are tagged kLoginRowIndex = 0 and kPasswordRowIndex = 1. As you might have guessed, I use this for setting login and password. If the user taps on the return button when editing the login textfield, I want the password textfield to get the focus. Unfortunately, the password textfield doesn't accept the focus. Here is my

How Can I orderly arrange items in Referencing Outlet Collection automatically?

狂风中的少年 提交于 2020-01-02 06:57:08
问题 I have Referencing Outlet Collection of UITextfields arranged in Xib as one below another. When I print Referencing Outlet Collection I found that its orderless. I need to automatically arrange text fields, ie text fileld comes 1st in UI should appear 1st in Outlet Collection Array. Any idea? 回答1: This is an unfortunate fact of IBOutletCollection . You may want to dupe rdar://12121242. You can set a tag for each view in IB, and then sort the collection by tag . You can also sort the

Swift 2 addObserver for specific textField with the object parameter

落爺英雄遲暮 提交于 2020-01-02 06:38:26
问题 To my understanding the object parameter of the addObserver method is the object you want to receive notifications from. Most of the time I see it as nil (I assume this is because notifications of the specified type are wanted from all objects). In my particular case I have a text field at the top of the screen and at the bottom of the screen and I want the view to move up only when the user taps the bottom text field, not the top one. So I call the following method in viewWillAppear func

UITableView with UITextField - keep the data even after user scrolls

╄→尐↘猪︶ㄣ 提交于 2020-01-02 06:31:23
问题 I have a UITableView and it has bunch of UITableViewCells - These UITableViewCells have multiple UITextFields inside it. Now every time I scroll up and down - and the UITableViewCells go out of the view - and comes back in whatever text I enter inside the UITextField disappears - What is the best way to make this work? 回答1: create an NSMutableArray which at each position, holds an NSString object which matches each cell. when you config + show each cell in - (UITableViewCell *)tableView:

UITableView with UITextField - keep the data even after user scrolls

蓝咒 提交于 2020-01-02 06:31:08
问题 I have a UITableView and it has bunch of UITableViewCells - These UITableViewCells have multiple UITextFields inside it. Now every time I scroll up and down - and the UITableViewCells go out of the view - and comes back in whatever text I enter inside the UITextField disappears - What is the best way to make this work? 回答1: create an NSMutableArray which at each position, holds an NSString object which matches each cell. when you config + show each cell in - (UITableViewCell *)tableView:

How to prevent keyboard changing from Numbers to Alphabet when the space key is touched?

二次信任 提交于 2020-01-02 04:52:08
问题 I have UITextFields on a table to enter values. Some of these fields accept only numbers. I am using UIKeyboardTypeNumbersAndPunctuation for the keyboardType, and shouldChangeCharactersInRange to filter the characters. Also, all the corrections are disabled: textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation; textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocapitalizationType = UITextAutocapitalizationTypeNone; On the numeric only fields, when the space key

iPhone - possible to not show keyboard but still show the cursor in a UITextField?

。_饼干妹妹 提交于 2020-01-02 04:50:27
问题 I have a custom keyboard I want to show when the user taps a UITextField. But at the same time I want to show the cursor in the textfield. If if return a NO for canBecomeFirstResponder, it doesn't show the default keyboard but doesn't show the cursor either. Can someone please help me out? Thanks. 回答1: The answer to your problem is to create a view for your custom keyboard and then edit the inputView property of your UITextField and pass it the view for your custom keyboard. I hope that helps