uitextfield

Manage long press on UITextfiled without disabling context menu?

一世执手 提交于 2019-12-08 04:13:47
问题 I've UITableView and its cell have one UITextField. Now I added long gesture in UITextField but it not working. When I tap long gesture on textfield it always show context menu (select,copy cut,past,etc.). My question is that how to manage long gesture as well as context menu in UITextFiled. I've tried below code: longGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; longGesture.minimumPressDuration = 2.0; //seconds longGesture.delegate =

Moving content located under the keyboard

白昼怎懂夜的黑 提交于 2019-12-08 03:56:39
问题 I have a question regarding the code found in the Apple documentation Moving content located under the keyboard. I have researched this, but I'm looking for clarification on the concepts I am fuzzy on here before I start getting fancy with alternate solutions. Unfortunately, as soon as the keyboard animation finishes moving the keyboard up, the view moves down and completely out of site. This happens whether the text field is actually the one that gets covered by the keyboard or not. So now I

how to avoid dots next to a uitextfield

邮差的信 提交于 2019-12-08 03:51:19
问题 Is that possible to remove the dots which are displayed next to uitextfield when text is larger than the width of the uitextfield. 回答1: There is a property lineBreakMode which defines the behaviour when the text to be displayed is larger than the box of the control //UILineBreakMode //Options for wrapping and truncating text. typedef enum { UILineBreakModeWordWrap = 0, UILineBreakModeCharacterWrap, UILineBreakModeClip, UILineBreakModeHeadTruncation, UILineBreakModeTailTruncation,

How to make a UIView Scrollable?

梦想与她 提交于 2019-12-08 03:49:27
问题 Hi there I have a UIView with a bunch of UITextfields. My problem is that my UITextfields are present from the top to the bottom of my screen. So when the keyboard pops up, it covers half the screen and consequently the UITextfields below...What can I do so that all the fields can be edited by simmply scrolling when the keyboard is visible? 回答1: You need to embed your UIView into a UIScrollView and then change the size of the UIScrollView when the keyboard pops up. 回答2: Just give the view a

UITextField get focus and then lose focus immediately due to return YES in textFieldShouldReturn

只谈情不闲聊 提交于 2019-12-08 03:32:54
问题 Here are my codes: - (void)viewDidLoad { [super viewDidLoad]; // passwordTextField cannot get focus after click next key due to this RAC RAC(self.loginButton, enabled) = [RACSignal combineLatest:@[self.userTextField.rac_textSignal, self.passwordTextField.rac_textSignal] reduce:^id (NSString *user, NSString *password) { if ([user length] > 0 && [password length] > 0) { return @YES; } return @NO; }]; } - (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textField == self.userTextField)

Validate text fields swift 3

夙愿已清 提交于 2019-12-08 02:53:26
I am trying to make all of my text fields required to make sure that users does not leave it empty. I tried this but for some reason it's not working. I feel like my logic is correct, but it's an issue with swift's logic Here is my code: let title = txtTitle.text! let location = txtWhere.text! let when = txtWhen.text! if title != nil && location != nil && when != nil { var titleArray = [String]() var whereArray = [String]() var whenArray = [String]() let titleObject = UserDefaults.standard.object(forKey: "saveTitle") let whereObject = UserDefaults.standard.object(forKey: "saveLocation") let

textFieldDidEndEditing firing “too late”

风流意气都作罢 提交于 2019-12-08 02:49:42
问题 I have a multiview process the user is entering in data and I'm saving it to the model class properties each step along the way. I use textFieldDidEndEditing to check if the input is valid, and if so, saves the entered data. On the view I have a continueButtonClicked event that checks to see if all the validations pass and if so loads the next view. I do NOT set the properties of the model here, because I think I shouldn't have to since each field is saved to the model 1 field at a time.

giving custom autosuggestion for uitextfield iphone

三世轮回 提交于 2019-12-08 02:21:39
问题 I have to implement a custom autosuggestion for UITextField> I have an array of words and when I start typing in a textfield then all words similar to the typed text should appear as auto suggestion, like normal auto suggestion in ios but more than one word. And When I tap on one of them it should trigger an event. I know how to done this with a tableview anybody know a method to done this with ios's look and feel? 回答1: For this purpose I used the project linked below: http://cocoacontrols

Swift - How to multiply value from UITextField

心已入冬 提交于 2019-12-08 02:05:54
问题 @IBOutlet weak var labelLabel: UILabel @IBOutlet weak var textFieldField: UITextField @IBAction func buttonButton(sender: AnyObject) { var conversionRate = 7 self.labelLabel.text = self.textFieldField.text // Here I'm trying to multiply textFieldField by 7 (conversionRate) textFieldField.resignFirstResponder() } Hello, I want to multiply a value from UITextField by 7. Can someone help me? I've tried everything. .toInt(), intValue() and nothing 回答1: It should work with .toInt() : if let number

Scroll on textField when begin Editing and keyboard appear

戏子无情 提交于 2019-12-08 01:10:26
问题 I've a viewController composed by an UIImageView that fills the whole view and two textField located at the center of the view. All this is located inside a ScrollView. I use Storyboard and I disabled the autolayout. When I click on a textField, and thus opens the keyboard, I'd like that the scroll is displaced directly on textField. How can I do that? 回答1: Consider that your TextField outlet is named txtField then implement UITextField Delegate using txtField.delegate = self; Considering