uitextfield

小总结

拥有回忆 提交于 2020-01-06 02:48:04
本文目录 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

UITextFieldDelegate method not called

非 Y 不嫁゛ 提交于 2020-01-06 01:56:45
问题 I'm following the Big Nerd Ranch iOS Programming book (Swift version) and I have this file. import UIKit class ConversionViewController: UIViewController, UITextFieldDelegate { @IBOutlet var celsiusLabel: UILabel! @IBOutlet var textField: UITextField! func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { print("here") return true } //rest of the code here } For some reason, the textField delegate method is not called.

UITextField Animation completes, but then pops back to original spot after user touches

ε祈祈猫儿з 提交于 2020-01-05 12:58:12
问题 I have three UITextField s that I have animating in by a setFrame: method. The animation itself works great, but the problem begins prior to the animation when the user makes touches on the screen. What occurs is that all three UITextField s disappear. One thing to note is that when I press cancel, and then press the button that re-instantiates the animation, the UITextField s reappear and also still have the string that was previously entered by the user. So it's not like they're actually

Require a UITextField to take 5 digits [duplicate]

社会主义新天地 提交于 2020-01-05 10:17:25
问题 This question already has answers here : Set the maximum character length of a UITextField (44 answers) Closed 4 years ago . I have a UITextField set up to show a number pad. How do I require the user to enter exactly 5 digits? I poked around and saw I should use shouldChangeCharactersInRange but I'm not quite understanding how to implement that. 回答1: I'd just use this when the user leaves the textfield/validates with a button if ([myTextField.text length] != 5){ //Show alert or some other

Stop UITextField cursor from blinking in iOS

时光怂恿深爱的人放手 提交于 2020-01-05 08:08:24
问题 Is there a way to stop the cursor from blinking in a UITextField? I know you can use [UITextField resignFirstResponder] and [UITextField setEnabled:NO] , but I'd like to keep the keyboard visible on the screen. Thanks! Update To clarify, I have no intention of hiding the cursor while the user is editing the text field, but I want to hide it after the user has hit Done and a progress indicator has appeared above the text field. A blinking cursor seems weird in a view that can't be manipulated

Stop UITextField cursor from blinking in iOS

荒凉一梦 提交于 2020-01-05 08:08:07
问题 Is there a way to stop the cursor from blinking in a UITextField? I know you can use [UITextField resignFirstResponder] and [UITextField setEnabled:NO] , but I'd like to keep the keyboard visible on the screen. Thanks! Update To clarify, I have no intention of hiding the cursor while the user is editing the text field, but I want to hide it after the user has hit Done and a progress indicator has appeared above the text field. A blinking cursor seems weird in a view that can't be manipulated

The buttons should be visible when the user is done entering the value in the textfield

ε祈祈猫儿з 提交于 2020-01-05 07:25:24
问题 I have two textfields and two buttons and the button should not be visible till the user starts entering into the second textfield or the user has done entering in the second textfield. Thanks, - (void)textFieldDidBeginEditing:(UITextField *)secondFIB { if (secondFIB.tag == 1703) { [self addPlusButton:[UIImage imageNamed:@"addButton1.png"] andFrameX:25 andFrameY:443 andFrameW:54 andFrameH:54]; [self addNextButton:[UIImage imageNamed:@"scenariosButton_active_green.png"] andTitle:@"Next."

How to add a label to textField class or animate placeholder

浪尽此生 提交于 2020-01-05 04:54:08
问题 I am trying to make my own google material textfield in ios. Where the underline changes colour when tapped and the placeholder text moves up when the user starts to fill in the textfield. Like this: I started by following this feed here. So far I have the line underneath the text working, so when the user taps the line changes colour and when the user taps outside the textfield the line changes back to original colour. I now need to work out how to make the placeholder text stay on screen

How can I check if the hide button pf iPad's keyboard was pressed?

∥☆過路亽.° 提交于 2020-01-04 05:28:54
问题 I want to trigger a function that will depend on which method the user used to resign a textField's first responder. If it was resigned by selecting another textField, it does nothing, else triggers a function. Is this possible? 回答1: Found out how. You just have to listen to the UIKeyboardWillHideNotification notification: - (void)viewDidLoad { [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(methodYouWantToCall) name

iPad UITextField — cursor not centering when resizing frame with contentVerticalAlignment = UIControlContentVerticalAlignmentCenter

大城市里の小女人 提交于 2020-01-04 05:19:08
问题 I am working on a universal iPhone/iPad app. I resize some of my UITextFields as the user types. I also have some code to move the UITextFields around so that their locations make sense as they are resized. This code is not too short, but basically it comes down to modifying the frames of the UITextFields. My UITextFields all have their content vertically centered by setting textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; The text centers just fine. But when I