uitextfield

UITextField: When beginning input, textfield bounces up, and then bounces down

喜你入骨 提交于 2019-12-24 11:33:56
问题 I've seen this with UITextView too. Clearly, I'm missing something pretty basic. I've tried: - Setting textsize to small - UITextField: Setting 1 line, no resize - Removing the ability to move the texfield import UIKit class XViewController: UIViewController, UITextFieldDelegate, UIGestureRecognizerDelegate { // UI elements let cancelButton = UIButton() let okButton = UIButton() var image:UIImage? var previewImageView:UIImageView = UIImageView() let textField = UITextField() let

Change the spellcheck / autocompletion source for a UItextField

夙愿已清 提交于 2019-12-24 10:41:06
问题 I have a UITextfield , and as the user enters some text I need the text field to suggest some words from an array. I have looked all over and it seems everyone is creating a table or something to display the suggestions. Is there a way I can customise the default iOS autocompletion to use my source for the suggestions? 回答1: You can't override the "default" spell checking autocompletion in UITextField, because the spell checking autocompletion is intended to correct errors and is handled by

How to achieve something like NSLineBreakByTruncatingHead for UITextField?

牧云@^-^@ 提交于 2019-12-24 10:39:41
问题 I need to achieve something exactly like NSLineBreakByTruncatingHead for UITextField as shown here. Let's assume the original text is: This is the long text that cannot be shown inside a UITextField I need it like: ...cannot be shown inside a UITextField but currently I am getting something like: This is the long text that cannot... simply the truncation at the beginning. The lineBreakMode property is not given for UITextField . How can I achieve it? 回答1: I took the solution here and modified

UITextField autocomplete

廉价感情. 提交于 2019-12-24 10:04:09
问题 Is it possible to autocomplete a UITextField bases on what is being entered? The reason why I need this is because I have a predefined set of words that the user needs to choose and the list is about 1000 item long. I want to display in UITableView and let the user chose but having 1k items in table list isn't I think a good idea. Thanks 回答1: You can do it by not showing all the 1k items in table view but you can populate your table view as the user starts typing letters in text field. For

UITextField becomeFirstResponder works only once

社会主义新天地 提交于 2019-12-24 08:01:13
问题 In my app, there is the ability for the user to input their name. A UITextField is added to the view and becomeFirstResponder is called. In the textFieldShouldReturn method, resignFirstResponder is called. Then in textFieldShouldEndEditing, the UITextField is removed from the view. This all works fine, but the problem is that when the user tries to input their name a second time, the UITextField shows but keyboard does not. I have tried lots of things, like moving around become/resign

iPhone SDK: how to get the value of a UITextField in an alert?

情到浓时终转凉″ 提交于 2019-12-24 07:45:36
问题 I'm really new at this. I've been working my way through a couple of "HelloWorld" type tutorials that basically have a text field, a button, and when you click the button it alerts whatever's in the text field. I've gotten as far as getting an alert to show and being able to set the title, message, and button text directly. However my attempts at getting the contents of my UITextField keep failing. I either get errors, no response, or just "(null)". My code's here. @synthesize textField; -

Question on App Store Review Guidelines

末鹿安然 提交于 2019-12-24 07:37:29
问题 In Apple new release "App Store Review Guidelines" http://developer.apple.com/appstore/guidelines.html I am confused with section 3.2 that stated " Apps with placeholder text will be rejected ". Does it means app should NOT use the placeholder property of UITextField? Thanks. 回答1: No. It basically refers to unnecessary text in the app's description that is meant to draw in a broader range of searches. 来源: https://stackoverflow.com/questions/3695466/question-on-app-store-review-guidelines

How could I get the property name of the current UITextField a user is in as a string?

核能气质少年 提交于 2019-12-24 06:52:03
问题 I am using the following method: - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string Before, in order to find the current text field I was in, I was able to write something like this: if (textField == self.textPlaceID) { //Do something } Is there a way to grab the name of my textField as a string? I am not asking to take what the user has typed in that textField , I'd like to be able to just get the property name of if.

Scroll view issues when key board moves up in UItextField / TextView iPhone

拟墨画扇 提交于 2019-12-24 06:51:11
问题 I have a scrollview on my view in that i have all the sub views as shown bellow UIView Scroll View 1.ImageView 2.Table view 3.Text View √√ To move the scroll view when keyboard appears / dismiss I have implemented logic in textview delegate metods as follows √√ - (void)textViewDidBeginEditing:(UITextView *)textView; { //To move the view down [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDelegate:self]; [UIView setAnimationDuration:0.3]; [UIView

Scroll view issues when key board moves up in UItextField / TextView iPhone

蹲街弑〆低调 提交于 2019-12-24 06:51:02
问题 I have a scrollview on my view in that i have all the sub views as shown bellow UIView Scroll View 1.ImageView 2.Table view 3.Text View √√ To move the scroll view when keyboard appears / dismiss I have implemented logic in textview delegate metods as follows √√ - (void)textViewDidBeginEditing:(UITextView *)textView; { //To move the view down [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDelegate:self]; [UIView setAnimationDuration:0.3]; [UIView