uitextfield

Close the keyboard on UITextField

落花浮王杯 提交于 2020-01-09 19:18:46
问题 I'm a newbie developing for iOS devices. I inserted an UITextField on InterfaceBuilder, and I assigned with the code: @interface ComposeViewController : UIViewController { id <ComposeViewControllerDelegate> delegate; IBOutlet UITextField *notificationTitle; } How I could allow to close the keyboard when the user press the "Return" key? 回答1: Set the Delegate of the UITextField to your ViewController, add a referencing outlet between the File's Owner and the UITextField, then implement this

Problem with multi-line JTextField

半世苍凉 提交于 2020-01-09 05:37:25
问题 I have a JTextField and need to have 3 lines in it, such as these: HI MY name is mehdi How can I set the text in a JTextField ? I tried \n , but it didn't work. 回答1: 1 : JTextField does not support multiline. what you want is a JTextArea 2 : Newlines aren't the same on all systems, you might have to use "\r\n" if you are running Windows. Since Java 7, there is System.LineSeparator to solve this issue. (see the Oracle documentation) 回答2: You can't get multi-line behavior on single-line

Using “Next” as a Return Key

£可爱£侵袭症+ 提交于 2020-01-09 02:06:13
问题 I use the "Next" value for the "Return Key" to get the Next button in place of the Done button, but (obviously) pressing it doesn't automatically move to the next UITextField in my view. What's the right way to do this? I have seen many answers, but anyone have a swift solution? 回答1: Make sure your text fields have their delegate set and implement the textFieldShouldReturn method. This is the method that is called when the user taps the return key (no matter what it looks like). The method

Disable UIScrollView scrolling when UITextField becomes first responder

99封情书 提交于 2020-01-08 13:55:12
问题 When a UITextField , embedded in a UIScrollView becomes first responder, by lets say the user typing in some character, the UIScrollView scrolls to that Field automatically, is there any way to disable that? Duplicate rdar://16538222 over 回答1: Building on Moshe's answer... Subclass UIScrollView and override the following method: - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated Leave it empty. Job done! 回答2: I've been struggling with the same problem, and at last I've found a

Disable UIScrollView scrolling when UITextField becomes first responder

淺唱寂寞╮ 提交于 2020-01-08 13:54:26
问题 When a UITextField , embedded in a UIScrollView becomes first responder, by lets say the user typing in some character, the UIScrollView scrolls to that Field automatically, is there any way to disable that? Duplicate rdar://16538222 over 回答1: Building on Moshe's answer... Subclass UIScrollView and override the following method: - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated Leave it empty. Job done! 回答2: I've been struggling with the same problem, and at last I've found a

how to update the textfield value in ios [closed]

梦想的初衷 提交于 2020-01-08 02:13:39
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have one textfield value like 100,000 using NSNumberFormatter, now I want to edit my textfield, to add one more 0 . After I Want to Change like the text like 1,000,000 but my textfield value is changed as 0 回答1

小总结

烂漫一生 提交于 2020-01-07 22:13:21
本文目录 0.UIView常用的属性和操作 0_1.UIView常见的属性 0_2.UIView状态 0_3.UIView常用的方法 1.文本框UITextField和文本视图UITextView 1_1.文本框UITextField(几乎包含了iOS控件的所有的通用属性) 1_2.文本视图UITextView 1_3.键盘输入的处理程序 2.标签UILabel和按钮UIButton 2_1.标签UILabel 2_2.按钮UIButton 3.滑块UISlider、步进UIStepper和图像UIImageView 3_1.滑块UISlider 3_2.步进UIStepper 3_3.图像UIImageView 3_4.图片浏览器 4.开关控件UISwitch和分段控件UISegmentedControl 4_1.开关控件UISwitch 4_2.分段控件UISegmentedControl 4_3.图片排序 5.工具栏UIToolBar 5_1.工具栏UIToolBar的使用 5_2.UIBarButtonItem 说明: 这个专题,是介绍了一些常用的普通空间的属性和使用,包括:UITextField、UITextView、UILabel、UIButton、UISlider、UIStepper、UIImageView、UISwitch、UISegmentedControl

How to set label according to text but i want background color also [closed]

女生的网名这么多〃 提交于 2020-01-07 08:35:37
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . How to set UILabel according to text but I want backGroundColor also in it, if text is small then it will display background small label with background color black and text and vice-versa.How to do? In image the

How to make UILabel and UITextField font size to be relative to screen size

喜夏-厌秋 提交于 2020-01-07 05:43:05
问题 I have a view controller which has a text field and label and I have set height constraint for text field and label and so I feel font size is not relative to the screen I believe. How can I make this items' font size to be relative to the screen size? 回答1: You can manually change UIlabel or UITextfield font in viewDidLayoutSubviews method of your ViewController or layoutSubviews method of your superView . Like this: CGRect screenSize = [UIScreen mainScreen].bounds; textField.font = [UIFont

How to make UILabel and UITextField font size to be relative to screen size

本秂侑毒 提交于 2020-01-07 05:42:12
问题 I have a view controller which has a text field and label and I have set height constraint for text field and label and so I feel font size is not relative to the screen I believe. How can I make this items' font size to be relative to the screen size? 回答1: You can manually change UIlabel or UITextfield font in viewDidLayoutSubviews method of your ViewController or layoutSubviews method of your superView . Like this: CGRect screenSize = [UIScreen mainScreen].bounds; textField.font = [UIFont