uitextfield

how to use persian numbers in UItextField in swift 3?

匆匆过客 提交于 2019-12-02 09:32:58
Hi I am using text field in my swift3 application - I want when user enter a number in the text field instead of english number textfield shows persian numbers - my textfield keyboard has set to just enter number so the user can't use text inside the text field with keyboard so here is my codes that doesn't work override func viewDidLoad() { super.viewDidLoad() let numberFormatter = NumberFormatter() numberFormatter.locale = Locale(identifier: "fa") numberFormatter.numberStyle = NumberFormatter.Style.decimal let cm:Int? = Int(englishNumber.text!) if cm != nil { numberFormatter.string(from:

How can I move to the previous UITextField if the “Backspace” button is pressed and the text field is blank and in Swift 4?

霸气de小男生 提交于 2019-12-02 08:59:32
问题 I am trying to figure this out. When I use the code below, I am able to move from one text field to the next and click the "Backspace" button but ONLY when the text field has text in there. My Question: How can I click the "Backspace" button when the text field is blank and move to the previous text field? Second Question: How do I get rid of the blinking blue line on the UITextField ? Below is the code that I have. Any help will be greatly appreciated! @objc func textFieldDidChange(textfield

Caps Lock Image on Password Protected UITextField

亡梦爱人 提交于 2019-12-02 08:51:16
问题 I am creating an app that requires the use of a USB Keyboard. (The normal touch screen keyboard has been disabled and will not show up.) When the user installs the app for this first time, they will need to create a four digit Pin. The input field for the Pin is password protected (as in dots will appear every time a new digit is entered). The Pin UITextField is set up to only except four numeric digits. Any other letters/numbers will not be added to the UITextField. This is what it looks

Disabling keyboard input when using a UITextField + UIPickerview

扶醉桌前 提交于 2019-12-02 08:36:37
问题 This project also click on the textfield pickerview opens, but the data shown above can be entered in the section. How can I turn it off? So just come to my choices below. If the textfield is clicked, I open the pickerview: import UIKit import NVActivityIndicatorView struct kategoriData { var text : String? var id : String? } class KonuEkleViewController: UIViewController,UITextFieldDelegate , NVActivityIndicatorViewable , UIPickerViewDataSource , UIPickerViewDelegate{ @IBOutlet weak var

How to add text to an active UITextField

大憨熊 提交于 2019-12-02 07:08:23
I have a couple of UITextField 's and one UIButton . If I tap on the UIButton , I want to place some static text in the active UITextField . So something like: @IBAction func buttonEen(sender: UIButton) { 'active textField'.text = "static text" } But how do I determine which UITextField is the active UITextField and how do I reach it? To write text in last active UITextField you have to make your UIViewController a delegate of UITextField ex: class ViewController: UIViewController, UITextFieldDelegate declare a activeField variable ex: var activeField: UITextField? then implements

custom UITextField with image as a background blinking cursor issue

こ雲淡風輕ζ 提交于 2019-12-02 07:05:47
I have a custom UITextField with a UIImage as a background. Now when I type in a text into this UITextField and the cursor is blinking I get this: I don't want to have a white image on the cursor blinking as it destroys the aesthetics. I tried playing around with this and tried setting the background view to have the same color as the image, however the issue is that the UITextField shape is always a rectangle. How do I solve this? Have you tried setting textField.backgroundColor = [UIColor clearColor] ? You can use a UIImageView for the image and then add a UITextField as a subview with clear

iPhone: how can I activate a text field programmatically (and not wait for the user to touch it)

对着背影说爱祢 提交于 2019-12-02 06:59:39
I have a UIViewController that is a UITextFieldDelegate, and I would like the keyboard for its text field to appear as soon as the user navigates to this view, without having to actually touch the text field. It would also be nice to be able to "dismiss" the entire view when the keyboard is dismissed. I am loading the view from a xib file. I don't have an ivar in the code for the UITextField as yet. I would guess I need one. At this point I am just relying on the delegate to pop up the keyboard. (I know its not a UITextViewDelegate, like the tag says, but I am new to stackoverflow and can't

Decimal point in UIKeyboardTypeDecimalPad can't be used in mathematical calculation

倖福魔咒の 提交于 2019-12-02 06:15:39
问题 I am using the keyboard type: UIKeyboardTypeDecimalPad for two UITextField objects. When trying to perform an addition, I get different results depending on the current locale: Case 1: US Format: the decimal point appears as . as expected. If I add 12.3 (text field 1) + 12.3 (text field 2), the answer will be 24.6. That's what I want. But: Case 2: Egypt Format: the decimal point appears as , . If I repeat the same calculation the answer will be 24. The decimal portion is ignored. Is there a

UITextfield not working as subview to UISearchBar in iOS 7?

自作多情 提交于 2019-12-02 06:12:45
问题 This code worked perfectly fine in iOS 6 but in iOS 7 the textfield is gray in the navigationBar, and not clickable? See the difference in this picture What may be wrong ? I am not aware of what they have changed exactly in iOS 7 and not sure where to start looking for solving this problem... /Regards UITextField *sbTextField = (UITextField *)[searchBar.subviews lastObject]; [sbTextField removeFromSuperview]; CGRect rect = searchBar.frame; rect.size.height = 32; rect.size.width = 210;

UITextView issue with ActionSheetStringPicker Picker view

点点圈 提交于 2019-12-02 06:09:26
问题 Check 3 screenshots here first. Screenshot 1 : Subject is UITextview field. When I tap on subject text field normal keyboard will come. There is no problem here now. Screenshot 2 : Priority is UITextfield view. Here I use UIActionsheet Picker view. When I click on Priority textfield picker will appear as shown in screenshot. This is also working fine. My Problem : When I click Priority textfield directly from Subject textview by scrolling without using done button or next button from keyboard