uitextfield

How can I show done button on the decimal pad keyboard?

大城市里の小女人 提交于 2021-02-10 17:09:15
问题 I'm trying to learn Swift and I've done on the view screens. But as you can understand more easily by checking the screenshot, when I enter a value into a text field, there isn't any done button showing up so I can not hide the keyboard from the screen. And that makes it impossible to press the submit button which is located bottom of the screen view. 回答1: Firstly, create a new Swift File . Add this to the file : import Foundation import UIKit extension UIViewController{ func toolBar() ->

How can I show done button on the decimal pad keyboard?

ε祈祈猫儿з 提交于 2021-02-10 17:05:22
问题 I'm trying to learn Swift and I've done on the view screens. But as you can understand more easily by checking the screenshot, when I enter a value into a text field, there isn't any done button showing up so I can not hide the keyboard from the screen. And that makes it impossible to press the submit button which is located bottom of the screen view. 回答1: Firstly, create a new Swift File . Add this to the file : import Foundation import UIKit extension UIViewController{ func toolBar() ->

Keyboard events called before UITextView delegate events

。_饼干妹妹 提交于 2021-02-10 05:30:52
问题 I have a UITableView with UITextViews and UITextFields on it's cells. As obvious the keyboard overlaps the lower cells and you cannot see what you are typing. So I want to scroll the tableview to get the field visible. I wrote the code the iOS docs recommended: https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html BUT the keyboard event callback keyboardWillShow: is called before the UITextView edit

c# Xamarin UITextField setting the cursor position

試著忘記壹切 提交于 2021-02-09 07:10:22
问题 I need to position the cursor of a UITextField in the exact same position as another previous text field. I get the position of the cursor in the first text field as nint index = txtToField.GetOffsetFromPosition(txtToField.BeginningOfDocument, txtToField.SelectedTextRange.Start); , which correctly gets the number of characters from the beginning of the textfield my cursor is currently in. After some research, and using the question below: Setting cursor position of UITextField I have tried to

c# Xamarin UITextField setting the cursor position

≯℡__Kan透↙ 提交于 2021-02-09 07:10:20
问题 I need to position the cursor of a UITextField in the exact same position as another previous text field. I get the position of the cursor in the first text field as nint index = txtToField.GetOffsetFromPosition(txtToField.BeginningOfDocument, txtToField.SelectedTextRange.Start); , which correctly gets the number of characters from the beginning of the textfield my cursor is currently in. After some research, and using the question below: Setting cursor position of UITextField I have tried to

How to validate UITextfield that satisfies 5 different conditions using shouldChangeCharactersInrange method?

柔情痞子 提交于 2021-02-08 11:54:33
问题 I’m trying to validate a Password Textfield in realtime (Swift 4.2 & Xcode 10.2.1). My question is how to validate the conditions listed below in UITextField's shouldChangeCharactersInrange method? Minimum 8 characters Maximum 50 characters Minimum 1 alphabet Minimum 1 number No special characters Also, there will be a gray color tick image on the left side of all 4 validation messages. As long as the condition are not met, image will be gray color tick. If validation succeeds, tick images

Secure text entry freezes when I try to type one character

雨燕双飞 提交于 2021-02-08 11:34:41
问题 I have a password text field which will crash the app if I try to type a single character. I have referenced this but still no luck. I am running iOS 11.2.6 Here are my configs 回答1: I just found out, if you are using Custom Class for UITextField, setting self.textColor in that class on Secure Text Entry text field might be the cause of freezing. I solved it by doing: if (!self.isSecureTextEntry) { self.textColor = UIColor.white } 来源: https://stackoverflow.com/questions/49169123/secure-text

shouldChangeCharactersIn Combined with Suggested Text

喜欢而已 提交于 2021-02-08 01:57:06
问题 I have a UITextField and am using the delegate method func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool The fields here have the ability to display suggested text (e.g. name). The problem comes in when a suggestion is taken versus when the user types in single letters. If a suggestion is taken (e.g. Tom) the delegate method fires but string just contains a blank space " ". This causes validation failure since it is

How to set text position to bottom in textField

夙愿已清 提交于 2021-02-07 13:39:42
问题 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

How to set text position to bottom in textField

南笙酒味 提交于 2021-02-07 13:39:16
问题 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