uitextfield

iPhone: Jump to next uitextfield in uitableview, how to?

我怕爱的太早我们不能终老 提交于 2019-12-21 17:14:30
问题 In my iPhone project I'm using a UITableview with UITableViewCells containing UITextfields. I have seen in many apps that it is possible to use a next button to jump to the next textfield in the next cell. What is the best way to accomplish this? My idea is to get the indexPath of the cell with the textfield that is being editing and then get the next cell by cellForRowAtIndexPath. But how can I get the indexPath of the cell I'm currently editing? Thanks! 回答1: Keep references to the

Change cursor in UITextField when set new text

六眼飞鱼酱① 提交于 2019-12-21 17:11:38
问题 I discovery one thing. If i set yes to function - textField:shouldChangeCharactersInRange:replacementString: The cursor stay in the same place I type, like ("|" = cursor) "|" => Empty , type a "a|" => type b "ab|" => change cursor "a|b" => type c "ac|b" => type d "acd|b" => change cursor "ac|db" => type backspace "a|db" => type backspace again "|db" => *result* But, if I have to change the text, like put a "-" in penultimate character, I do the logic thing and set the text with: [textField

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

浪子不回头ぞ 提交于 2019-12-21 17:02:11
问题 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. 回答1: Use -viewWillAppear: in your view controller to send your text field a -becomeFirstResponder message, e.g.: - (void)

iOS UITextField- dismissing custom inputView

折月煮酒 提交于 2019-12-21 12:17:22
问题 I am using a custom inputView for some textfield, however when i call resignFirstResponder on the textfield, the custom input view does not dismiss...any suggestions? UITextField *f=[[UITextfield alloc] init]; UIView *view=[[UIView alloc] initWithFrame..]; [f setInputView:view]; //random example of how to set a textfields input view to a custom view After some research, this issue only occurs when working with a viewController thats presented in a modal view...it works ok otherwise... Thanks

textFieldDidBeginEditing is called prematurely

試著忘記壹切 提交于 2019-12-21 12:11:48
问题 I have an application in which I have to scroll up in case of the keyboard showing. to get the keyboard size, I'm registering the UIKeyboardWillShowNotification event like so: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:self.view.window] This does work, the problem is, it is being called after the textFieldDidBeginEditing was called. So, I can't get the actual keyboard size, but only after the field is

iOS - Moving a UITextField to a Different Position when a UIView Moves

故事扮演 提交于 2019-12-21 05:39:06
问题 I have a main UIView which moves up by means of a switch. I have this working and there is no problem there. Now the UIView when down, takes up about half of the Screen and when it is pushed up it shows the bottom 40px. In the UIView when it is down it has a UITextField and it sits somewhere in the middle. When the UIView is pushed up I want that UITextField to move to sit within those 40px, so that it always accessible. This is the code I got for the UIView to move: -(IBAction)mainview:(id

UITextfield text position not animating while width constraint is animated

我的未来我决定 提交于 2019-12-21 05:05:37
问题 I have three UITextField aligned in a container used to choose a date. At first only the month textfield is shown in the container and takes the full width, then when the user chose the month, the day textfield appear and they both take half of the container. The text alignement in these textfields is centered. My problem is that when I animate their size, the text doesn't animate and jumps directly to the final position while the width of the textfields animate correctly . Step 1 : The

UITextField get currently edited word

不羁的心 提交于 2019-12-21 04:59:24
问题 I'm working on an autocompletion component and I have one problem that I would like to solve in some easy way. I want to support edits to autocompleted text, for example: blablabl @usertag blablabl If user goes back and edits @usertag string, I would like to start autocompletion when it's edited. Question is, how to get currently edited word from textfield. I thought about taking cursor position, seperate nsstring to word by " " (space) and count letters from first word to cursor position. Is

UITextField How to check if a delete key is pressed

北城余情 提交于 2019-12-21 04:27:34
问题 I am implementing a search bar from my local database that searches from db as user enters info.The issue is that i concat recent character and the previous ones and then send it for search.How can I REMOVE the character (last one) when back key is pressed.I am using - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string Thanks for the replies 回答1: You can get the string that is supposed to be in text field after this

Change UITextField's placeholder text color using Userattributes?

你离开我真会死。 提交于 2019-12-21 04:12:49
问题 I want to change Place holder color from user attributes (interface builder) because i dont want to subclass my UITextfield etc... i searched on internet and found this "_placeholderLabel.textColor" Yes this works well Programmatically [self.tfEmail setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"]; but i want to use it in user attributes in interface builder. 回答1: Try removing '_', Works for me. 回答2: Without USING USER ATTRIBUTES self.txtField.attributedPlaceholder =