uitextfield

Iphone textfield display cursor

佐手、 提交于 2020-01-04 04:18:10
问题 i'm developing a calculator for iphone. The design is similar to this: The problem is that i can't show the cursor in my textField because the input is managed from buttons like the image. Moreover [textField becomeFirstResponder ] doesn't work because it shows the default keyboard. So i tried to textResultado.inputView = scrollView; but then the tabBarController can't receive touch events because my custom keyboard contained in the scroll view is over it. The caption is from an app in the

Get position of cell or text field in this cell

谁说胖子不能爱 提交于 2020-01-03 18:38:27
问题 I have a split view controller: view & tableview. In this table view I have custom cells with text field. I don't know how many cells will I have, so it generate automatically. And now I'm trying scroll to textfield, when it becomeFirstResponder. I've tried something like this: -(void) textFieldDidBeginEditing:(UITextField *)textField { CGPoint focusOnTextField = CGPointMake(0, 300 + textField.frame.origin.y); [scroller setContentOffset: focusOnTextField animated: YES]; } 300px - start

Get position of cell or text field in this cell

∥☆過路亽.° 提交于 2020-01-03 18:36:27
问题 I have a split view controller: view & tableview. In this table view I have custom cells with text field. I don't know how many cells will I have, so it generate automatically. And now I'm trying scroll to textfield, when it becomeFirstResponder. I've tried something like this: -(void) textFieldDidBeginEditing:(UITextField *)textField { CGPoint focusOnTextField = CGPointMake(0, 300 + textField.frame.origin.y); [scroller setContentOffset: focusOnTextField animated: YES]; } 300px - start

Get character before cursor in Swift

雨燕双飞 提交于 2020-01-03 15:15:46
问题 Yesterday I was working on getting and setting the cursor position in a UITextField. Now I am trying to get the character just before the cursor position. So in the following example, I would want to return an "e". func characterBeforeCursor() -> String Notes I didn't see any other SO questions that were the same of this, but maybe I missed them. I wrote this question first and when I find an answer I will post both the question and the answer at the same time. Of course, better answers are

Changing UITextField borderstyle in didEndEditing

邮差的信 提交于 2020-01-03 09:19:06
问题 I want to highlight a uitextfield when a user is editing it, so I set my textfield's borderstyle default to UITextBorderStyleNone and use the uitextfields delegates as following: - (void)textFieldDidBeginEditing:(UITextField *)textField { [textField setBorderStyle:UITextBorderStyleBezel]; } - (void)textFieldDidEndEditing:(UITextField *)textField { [textField setBorderStyle:UITextBorderStyleNone]; } The Bezel style gets set and rendered, but when the endediting is called, the none style is not

UIPickerView and UITextField get value from UIPickerView

寵の児 提交于 2020-01-03 04:54:46
问题 Ok I am having trouble figuring out how to approach this. I have a UITextField which I add to a UITableView dynamically according to the definitions of a XML file, in the XML file I may specify a list as one of the data types and what I do then is add a UIPickerView that displays the list to the inputView of my specific UITextField. What I am having trouble with is figuring out how to take the selected value from the UIPickerView and add it to the text property of my UITextField My

To move to next text fieds in table cell

佐手、 提交于 2020-01-03 00:56:13
问题 In my application , there is a table view with 2 text fields per cell. Am assigning tags for each text field. On pressing done button i want to make the next text field the first responder(can be between table cells). But the code now i am using does not work . attaching the present code NSArray *viewsToBecomeFirstResponder = [tableView subviews]; for (UIView *firstResponder in viewsToBecomeFirstResponder) { if ([firstResponder isKindOfClass:[UITextField class]]) { if (firstResponder.tag ==

How can I disable a button until text in all UITextFields has been entered in swift?

旧街凉风 提交于 2020-01-02 23:59:13
问题 I need a way to disable the save button until text has been entered in all of the required text boxes? I am developing the application in Swift and I have found lots of answers in Objective-c. As I have absolutely now Objective-c knowledge, I am unable to work out what it means. Does anybody have a solution for this which can be done in Swift? I know how to enable/disable a button. I also know how to check if a text field is empty. I'm just not sure how to make it so that my code is always

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

空扰寡人 提交于 2020-01-02 13:20:33
问题 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

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

匆匆过客 提交于 2020-01-02 13:19:10
问题 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