uitextfield

How do I change the UITextField so it looks like the Search Text Field?

空扰寡人 提交于 2019-12-04 12:47:20
I would like to change the standard iPhone UITextField so that it looks exactly like the search text field within the UISearchBar. You can see an example of this for the SMS text entry field within the iPhone Messages application. I do not believe that the UITextField has a style property that will meet this requirement. Any ideas? If you want, you can actually extract the background image from a uisearch bar and make it a stretchable image to use as the background of a UITextField. I did the same thing and it works like a charm for me. Here's the code i used to extract it: UIImage *img = [[

How to detect that speech recogntion is in progress

风格不统一 提交于 2019-12-04 12:31:26
Problem: I have UITextField side by side with UIButton with send functionality. When user presses send button I'm performing simple action: - (IBAction)sendMessage: (id)sender { [self.chatService sendMessage: self.messageTextField.text]; self.messageTextField.text = @""; // here I get exception } Now when user starts using dictation from keyboard, then presses done on dictation view (keyboard) and immediately presses send button, I've got exception "Range or index out of bounds". Possible solution: I've noticed that other applications disable this "send" button when speech recognition server

How to select a UITextField?

安稳与你 提交于 2019-12-04 11:52:45
问题 I want to edit the user's username inside a UITableView. I added a UITextField to the UITableViewCell and this seems to work very nicely. But when the user touches the cell (even outside the textfield), he expects to edit. How do I programatically select the textfield? The code would look something like: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { userName.selected = TRUE; } 回答1: - (void)tableView:(UITableView *)tableView

iOS - Add Tap Gesture to UITextField

一笑奈何 提交于 2019-12-04 11:31:08
I have problem with add a Tap Gesture to my UITextField. Below code: @IBAction func hanldeTap(recognizer: UITapGestureRecognizer) { println("works") } This action is associated with Tap Gesture Recognizer. In my TextField I have defined gestureRecognizer in OutletCollections . In my guess it should works. In described configuration gesture works e.x. for button or custom view. Can you tell my what could go wrong and how can I fix this? UITextField has delegate methods , you might want to consider implementing those. Or just add action event to your textfield. For example in viewDidLoad

Multiple pickerviews with multiple textfield inputviews Swift

梦想的初衷 提交于 2019-12-04 10:38:16
问题 I've been searching through the forum and nothing has helped. I am using 4 text fields in one view controller, and for each textfield, I am using a separate pickerView as the inputViews for the textFields (4pickers). When I click on the first textField, pickerView1 successfully appears and the textfield displays the data, however when I click on the second, third and fourth textfields,the first pickerView appears. I suspect the error lies in the inputView declarations. And I would so

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

有些话、适合烂在心里 提交于 2019-12-04 10:35:00
问题 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. $

How to remove special characters'&' from UItextField iPhone

自古美人都是妖i 提交于 2019-12-04 10:06:02
问题 I searched a lot over Google, but cant find a valid solution for best way to remove special characters'&' from Text Field in iPhone I only want to remove or delimit user to enter '&' keyword. I know that I have to do something in function - (BOOL)textField:(UITextField *)textFieldBeingChanged shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string But what exactly not getting it properly. Thanks in advance..... 回答1: See if this works : -(NSString *)

UIKeyboardWillShowNotification not calling and only UIKeyboardWillHideNotification calling in iOS 9

不想你离开。 提交于 2019-12-04 09:27:28
All is working good till iOS 8. But when user tap on text field control comes directly in UIKeyboardWillHideNotification notification Log in console -Can't find keyplane that supports type 4 for keyboard iPhone-PortraitTruffle-NumberPad; using 675849259_PortraitTruffle_iPhone-Simple-Pad_Default Here is the code-- ` In view did load - (void)viewDidLoad { [super viewDidLoad]; self.txtMobNumber.delegate = self; self.txtMobNumber.keyboardType = UIKeyboardTypeNumberPad; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:@"UIKeyboardWillShowNotification

Resigning First Responder for multiple UITextFields

回眸只為那壹抹淺笑 提交于 2019-12-04 09:13:58
问题 There is an application in which I am generating multiple UITextFields dynamically. I want to resign first responder whenever the UITextFields are not selected (touch outside the UITextField ). How can I know that of which UITextField I have to resign first responder? Please specify any other way beyond the 'tag' concept because I have tried that. Please suggest the right direction. Thanks in advance. 回答1: Don't call resignFirstResponder ; call endEditing: ! Call endEditing: on any view above

How to open the view with the keyboard appearing when the view is already loaded?

前提是你 提交于 2019-12-04 09:11:35
I have a requirement where I have a textfield in a view. When I want to open the view by switching the tab (TabBased Application), first time when the view is loaded the keyboard appears because i loadview method is called. But when I switch to tab2 and again switch to tab1 again, load view is not called. I want the keyboard to appear every time I open the tab1 page. Use -viewWillAppear: in your view controller to send your text field a -becomeFirstResponder message, e.g.: - (void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [myTextField becomeFirstResponder]; } 来源: https: