uitextfield

How to set text position to bottom in textField

狂风中的少年 提交于 2021-02-07 13:38:18
问题 I created a textField through code using the following code UITextField *txtObj=[UITextField alloc]initWithFrame:CGRectMake(88,100,80,33)]; I am getting the textfield as i planned, but the text we type in that text field seems to appear in the top area of text but not in bottom.I tried to align it but i got tired. Can anyone tell me what's the solution 回答1: it should be: txtObj.contentVerticalAlignment = UIControlContentVerticalAlignmentBottom; This property is inherited from the UIControl

Text Field creates action not outlet

谁都会走 提交于 2021-02-07 12:45:38
问题 I'm working on my first app with multiple view screens and everything worked great on the first view, I added a couple text fields and was able to connect them to the controller as Outlets and obtain the value from them, manage it and spit it back out to a label. I tried control-dragging the text fields on the second view to the secondControllerView and the only thing available when I do so is Action, no outlet, so its a function not a variable and I also cannot connect the labels to the code

Get UITextField from UIView using an Identifier/Tag (SWIFT)

↘锁芯ラ 提交于 2021-02-07 07:27:48
问题 I need to know how I can access a particular UITextField within a UIView from the ViewController class. The setup I have currently is that I have ViewController that is linked to a View in Storyboard. I have UIView in nib that has 3 UITextFields. I load the view up using the following code: TextFieldView = UINib(nibName: "TextView", bundle: nil).instantiateWithOwner(nil, options: nil)[0] as! UIView self.view.addSubview(TextFieldView) I can get all three UITextField and their values using the

Getting info from UITextField

百般思念 提交于 2021-02-07 04:47:30
问题 I have a UITextField and I ask the user to input some data using the number pad. Is the data that comes out a string or an integer? How do I multiply the number they input by 10 then output it to a label? 回答1: Just use the text attribute of the UITextField to get the value (which is a String). Then, use the toInt() method (which returns an optional) to convert that to an Integer, so that you can perform mathematical operations. @IBOutlet weak var field: UITextField! @IBOutlet weak var label:

Why does my UITextfField seems to be NOT nil, even if I leave the field empty? My “else” part of the if-statment is not being read

感情迁移 提交于 2021-02-05 08:28:11
问题 I am practicing swift programing by making an app that holds customers' data. The app has several text fields where people are supposed to type their name, email address, phone number, and quantity of products purchased. Then with a 'submit' button they save that information into the data base. However, if one of the fields is empty, an error should be thrown and a message should appear to the user letting him/her know that one of the fields empty. The problem is that even if the textfield is

Having textfield background transparent, but placeholder text opaque

折月煮酒 提交于 2021-01-28 13:50:40
问题 Is it possible to have a textfield's placeholder text opaque while its background is set to be transparent, eg. if I choose some background color, and set alpha to some value, like this: the placeholder text becomes transparent as well. But I want it opaque. So, is this achievable, preferably using storyboard ? Or at least through the code. If it is unclear what I am trying to achieve, just let me know , and I'll post an image with an example. 回答1: You can set the color's transparency instead

How to hide passwords in a UITextField like “*****”?

青春壹個敷衍的年華 提交于 2021-01-28 10:44:54
问题 How to hide passwords in a UITextField like "*****" ? To hide password, i used following code txtPassword.isSecureTextEntry = true but this will display like “•••••••” , but i need like "*******" 回答1: To achieve the same, you can use a normal textfield without the secure input option. When a user enters a character, save it to a string variable, and replace it in the textfield with the character you wish to present instead of the bullets. Set the textField delegate in viewDidLoad() as:

How to hide passwords in a UITextField like “*****”?

耗尽温柔 提交于 2021-01-28 10:40:28
问题 How to hide passwords in a UITextField like "*****" ? To hide password, i used following code txtPassword.isSecureTextEntry = true but this will display like “•••••••” , but i need like "*******" 回答1: To achieve the same, you can use a normal textfield without the secure input option. When a user enters a character, save it to a string variable, and replace it in the textfield with the character you wish to present instead of the bullets. Set the textField delegate in viewDidLoad() as:

Programmatically Hide Keyboard Shortcut Bar iOS 13

微笑、不失礼 提交于 2021-01-28 05:11:34
问题 I am trying to programmatically remove the keyboard shortcut bar that appears at the bottom of an iPad when an external keyboard is connected. There are plenty of posts and answers with "solutions" to this, but none of them work with the latest iOS. The closest solution was such: UITextInputAssistantItem* item = [self inputAssistantItem]; item.leadingBarButtonGroups = @[]; item.trailingBarButtonGroups = @[]; All this currently does is remove the buttons on the left side of the bar. And this

Swift assigning multiple classes to UI element

天大地大妈咪最大 提交于 2021-01-27 22:21:11
问题 Is it possible to assign multiple custom classes to the same UI Element in Swift? I have a UITextField that I need to animate with Spring(Animation library) and I also need to use some other library on the same UITextField that provides some other functionality. I usually assign the custom class in the identity inspector custom class section in the storyboard but I can't find a way to assign multiple classes. I also tried to create a new class and inherit from both of these libraries that I