uitextfield

iOS 11 - disable smart quotes

本秂侑毒 提交于 2019-12-01 03:09:06
iOS 11 adds smart quotes when typing. In macOS we can disable smart quotes on a NSTextView by setting: textView.automaticQuoteSubstitutionEnabled = NO; Neither UITextField or UITextView seem to have this property or the enabledTextCheckingTypes property. How can smart quotes be disabled on iOS 11? Smart quotes and other features such as smart dashes are controlled via the UITextInputTraits Protocol which is adopted by both UITextField and UITextView . Specifically, the smartQuotesType property can be set to one of .default , .yes or .no . At this time there is no further documentation on these

IOS: UItextfield disabled

a 夏天 提交于 2019-12-01 02:51:16
问题 When we push on a textfield, a cursor appear in this textfield; but I don't want that this cursor appear; then I want make this textfield disabled, where you can't write inside, how can I do? 回答1: Can you set enabled property/userInteractionEnabled of text field to No in ViewDidLoad() using the code textField.enabled = NO; or textField.userInteractionEnabled = NO; 回答2: If you're working with storyboards or .nib files and you want it to start out disabled you can also easily uncheck the

Allowing only alphabets in textField

北城余情 提交于 2019-12-01 00:50:55
I want to make a UITextField to accept only characters and display error when numbers or special characters are entered.But when Im doing so ,when I enter alphabets also error is displayed.Could not understand where I going wrong? NSString *FNameReg=@"[A-Za-z]"; NSPredicate *FNametest=[NSPredicate predicateWithFormat:@"SELF MATCHES %@",FNameReg]; if(![FNametest evaluateWithObject:txtfirstname.text]) { lblvalidateFName.hidden=NO; [testScroll setContentOffset:CGPointMake( 0 , 74)]; return; } BUt now when I give alphabets also then also error is displayed.Y is it so ? Create one method for

Make UITextField which has a static and attributed prefix

我是研究僧i 提交于 2019-12-01 00:46:01
I would like to make a UITextField , which has a static prefix and that the user cannot edit or delete, which at the same time is also attributed with a light gray font color. The editable part of the text field should always be shown in black color. An example is given below: It is essentially for typing in a user name, with a constantly prefixed domain. I have already tried using the textFieldShouldClear and textField:shouldChangeCharactersInRange:replacementString: delegate methods together with NSMutableAttributedString , but simply haven't been able to crack it: - (BOOL)textField:

keyboard not responding to resignFirstResponder

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 00:27:13
Instead of showing the keyboard I want to display a popover view when a textField is selected (my code is at the bottom). If the keyboard isn't showing then everything works great. However, if the keyboard is showing and then the textfield is selected the keyboard doesn't get dismissed, somewhere the firstResponders must be getting lost but I don't know where. Does anyone have a solution to this? My textfield: self.startDateTextField = [[UITextField alloc] initWithFrame:CGRectMake(79, 148, 138, 27)]; [self.startDateTextField setBorderStyle:UITextBorderStyleRoundedRect]; [self

UITextField with a dropdown menu for iPhone

99封情书 提交于 2019-12-01 00:21:34
Is there an easy way to create a drop down menu for a UITextField, so that the user can type a custom entry or select one from a list? For drop down menu you can implement UITableView. You can populate this UItableview with your list. Just declare it in ViewDidLoad method of your ViewController and then you can show or hid accordingly later. TableView = [[UITableView alloc]initWithFrame:CGRectMake(x,x,x,x) ]; TableView.delegate = self; TableView.dataSource = self; Add this to main view when user clickes on UITextField. [self.view addSubView:TableView]; If you want user to select from given

How to move to the next UITextField automatically in Swift

萝らか妹 提交于 2019-12-01 00:02:55
I have 2 textFields with NumberPad keyboard type @IBOutlet weak var ourTextField: UITextField! @IBOutlet weak var forThemTextField: UITextField! and I want to automatically move to the other textfield (from ourTextField to forThemTextField) after entering two numbers inside the ourTextField then after going to the other textfield (forThemTextField) and entering 2 numbers I want the keyboard hide automatically I have added a condition to only accept two numbers in my textFields by this code : func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString

In custom Prototype Cell in UITableView, UITextField value replaces with other Prototype Cell

人盡茶涼 提交于 2019-11-30 23:56:57
I have taken one UITableView and inside that I have used 2 prototype cells, now in those prototype cells, i have taken 1 UITextField . Now when I run the app and enter value in first prototype cell then i scroll UITableView , then first prototype cell's textfield value come to last prototype cell's textfield value. so it replace everytime i scrolldown or scroll up. sometime it goes blank. here is my code - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if(indexPath.row==0) { Client_MobileCell *cell = [tableView

How to call a method when the Done Button in the KeyBoard is Clicked?

邮差的信 提交于 2019-11-30 23:47:59
I want to call a method when the done button is clicked in the UITextField KeyBoard? Please Help me... It's not even necessary to implement the delegate. I greatly prefer using good, old-fashioned target/action pattern to handle this. It can also lead to cleaner code if you have multiple ways of ending editing (say, intercepting touches outside the text field to cancel editing). To use target/action, simply wire up UIControlEventEditingDidEndOnExit , which shows up in Interface Builder as the Did End On Exit event. No muss, no fuss. A lot cleaner and easier than implementing the delegate. See

How to get left padding on UITextField leftView image?

元气小坏坏 提交于 2019-11-30 21:02:48
I am setting up a UIImageView as a leftView on a UITextField like so: UIImageView *envelopeView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.height*.1, self.height*.1)]; envelopeView.image = [UIImage imageNamed:@"envelope.png"]; envelopeView.contentMode = UIViewContentModeScaleAspectFit; envelopeView.bounds = CGRectInset(envelopeView.frame, 15, 10); self.emailAddress.leftView = envelopeView; self.emailAddress.leftViewMode = UITextFieldViewModeAlways; which gets me the following: As you can see the left size of the image goes right up to the left edge of the button even though I