uitextfield

Trying to format a UITextField to behave like a currency calculator for only numeric input in iOS

与世无争的帅哥 提交于 2019-12-03 06:14:54
I have a UITextField in my application that is supposed to receive only numeric input from the user. This numeric input is supposed to represent currency (i.e. have only two decimal places), have the default value of 0.00 when nothing has been entered. I also would like to have a "$" sign that is on the far left, with the number right aligned, such that the number moves from right to left like such: e.g. when entering the number "1234.56" . 1. $ 0.00 . 2. $ 0.01 . 3. $ 0.12 . 4. $ 1.23 . 5. $ 12.34 . 6. $ 123.45 . 7. $ 1,234.56 . 8. and so on... I have the UITextField right aligned so that it

Set UITextField text property in prepareForSegue

好久不见. 提交于 2019-12-03 06:04:26
I have a textField in my ViewController1. I have a push segue to my ViewController2 which also has a textField. I need to set the textField.text in my ViewController2 to be equal to the text in the textField in my ViewController1. Here's the code I have: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqual:@"ViewController2"]) { ViewController2 *VCT = [segue destinationViewController]; VCT.title = @"View Controller #2"; VCT.textField.text = self.textField.text; } } The title setter works just fine. Why is the textField not working? You cannot set

iOS Keyboard (inside UIRemoteKeyboardWindow) is Not Shown When UITextField Becomes First Responder in Touch ID Completion Block (iOS 10)

ⅰ亾dé卋堺 提交于 2019-12-03 05:59:54
I've recently discovered a problem in my app that only seems to occur in iOS 10 where the system keyboard does not display when programmatically triggering a text field to become first responder inside of a completion handler -- specifically the completion handler I get back from a Touch ID attempt. The crazy part of this issue is, even though the keyboard is not shown, the area on the iPhone where the keyboard normally would be is still responding to touch inputs as if the user is typing on the keyboard! After doing a lot of investigation and debugging into the issue, I stumbled across the

Disabling user input for UITextfield in swift

六眼飞鱼酱① 提交于 2019-12-03 05:25:50
问题 pretty trivial question, I know. But I can not find anything online. I need to disable the user from being able to edit the text inside of a text field. So that when the click on the text, a keyboard doesn't show up. Any ideas? A programmatic solution or if it is possible through storyboards would be great. 回答1: Try this: Swift 2.0 : textField.userInteractionEnabled = false Swift 3.0 : textField.isUserInteractionEnabled = false Or in storyboard uncheck "User Interaction Enabled" 回答2: Another

UITextField set placeholder color as dark in iOS

女生的网名这么多〃 提交于 2019-12-03 05:19:52
问题 I have tried to set UITextField "Placeholder" color as dark. NSAttributedString * search = [[NSAttributedString alloc] initWithString:@"Search" attributes:@{NSForegroundColorAttributeName: [UIColor blackColor]}]; textField.attributedPlaceholder = search; But still UITextField showing light gray color in "Placeholder" . Is it possible to set dark "placeholder" color for UITextField ? Also I Have tried the another method as well [textField setValue:[UIColor blackColor] forKeyPath:@"

It is possible to show keyboard without using UITextField and UITextView iphone app?

送分小仙女□ 提交于 2019-12-03 04:45:51
问题 I am working in iPhone messaging based app. I want to show keyboard with keyboard inputAccessoryView in keyboard without using UITextView and UITextField . It is possible to do this? Please any one help me on this. Thanks in advance. Looking forward your help. Thanks. EDIT: Because i don't want the UITextField / UITextView and the control to be in UITextView / UITextField . I am going to add inputAccessoryView on the keyboard is UITextView . when the user touches the UITextview in the

Detect Focus Change for UITextField

邮差的信 提交于 2019-12-03 04:43:59
问题 I'm trying to set the animation for the view to move up when keyboard is hiding and appearing for the text fields and I got it to work perfectly fine, but when the focus moves from one text field to another, it doesn't work since the keyboard was already shown. In viewDidLoad, I registered the following: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver

Swift UITextFieldShouldReturn Return Key Tap

断了今生、忘了曾经 提交于 2019-12-03 04:43:06
问题 (iOS8, Xcode6, Swift) Using Swift, how do I capture a tap on the "Return" button? The doc at the following link specifies using the textFieldShouldReturn method: // Swift @optional func textFieldShouldReturn(_ textField: UITextField!) -> Bool Where I'm hung up is in the "_ textField" part. I've created the text field using Storyboard. How do I capture notifications for this specific text field? Do I need to create a new class and set it as a delegate for this text field? Do I assign the text

UITextField secureTextEntry - works going from YES to NO, but changing back to YES has no effect

只愿长相守 提交于 2019-12-03 04:41:33
问题 The above says it all- I have a UITextField set to secure, but want to give users the option to make it not secure (so they can see for sure what they typed if they are in a private area). However, suppose they hit the toggle by mistake, and want to change it back to secure mode? That does not work. I've tried everything - using -1 instead of YES, deleting the text and then putting it back. I'm at a total loss on other ideas. [Entered rdar://9781908] EDIT: I believe this issue is fixed as of

how to show pickerview in uitextfield not the keyboard?

夙愿已清 提交于 2019-12-03 04:35:18
问题 I want to show a UIPickerView on becoming FirstResponder of a UITextfield not the keyboard and fill the value in text field form the picker view. any one knows this? 回答1: Edit: this answer was correct at the time of writing. Apple has since introduced inputView . Mafonya answer is what you should be doing nowadays. It is possible to prevent the keyboard from popping up. Set your class to be the delegate of the UITextField: textField.delegate = self and add: <UITextFieldDelegate> after your