uitextfield

Add a button on right view of UItextfield in such way that, text should not overlap the button

蓝咒 提交于 2020-01-11 15:37:00
问题 I can add a button to a textfield on the right hand side of the UITextField using the right view however, the text overlaps on the button. Below is the code for right view button UIView.commitAnimations() var btnColor = UIButton(type: .Custom) btnColor.addTarget(self, action: #selector(self.openEmoji), forControlEvents: .TouchUpInside) btnColor.frame = CGRect(x: CGFloat(textField.frame.size.width - 25), y: CGFloat(5), width: CGFloat(25), height: CGFloat(25)) btnColor.setBackgroundImage

ios How to add bottom border and side design to textfield

旧城冷巷雨未停 提交于 2020-01-11 13:56:14
问题 I would like to add bottom border like as below image , I have added botom line successfully but i'm not getting side small lines Here is my code CALayer *border = [CALayer layer]; CGFloat borderWidth = 1; border.borderColor = [UIColor lightGrayColor].CGColor; border.frame = CGRectMake(0, textField.frame.size.height - borderWidth, textField.frame.size.width, textField.frame.size.height); border.borderWidth = borderWidth; [textField.layer addSublayer:border]; textField.layer.cornerRadius=30;

how to use persian numbers in UItextField in swift 3?

心已入冬 提交于 2020-01-11 13:16:55
问题 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 =

how to use persian numbers in UItextField in swift 3?

▼魔方 西西 提交于 2020-01-11 13:16:06
问题 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 =

Default parameter values error: “instance member cannot be used on type viewcontroller”

杀马特。学长 韩版系。学妹 提交于 2020-01-11 11:04:59
问题 In my view controller: class FoodAddViewController: UIViewController, UIPickerViewDataSource, UITextFieldDelegate, UIPickerViewDelegate { let TAG = "FoodAddViewController" // Retreive the managedObjectContext from AppDelegate let managedObjectContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext @IBOutlet weak var foodName: UITextField! @IBOutlet weak var foodPortion: UITextField! @IBOutlet weak var foodCalories: UITextField! @IBOutlet weak var foodUnit:

How can I set an accessibility trait for the placeholder text in UITextField?

若如初见. 提交于 2020-01-11 08:45:11
问题 I'm going through our iOS app to fix accessibility issues. One of the features of the app is a UITextField in which the user can enter search queries. I've set the trait of the field to be "search field", and VoiceOver does a good job with the field most of the time. When there's text in the field, it reads the text, then says "search field". The problem I want to solve is how VoiceOver handles the placeholder text. When the text field is empty, we've set the placeholder text to show a sample

Clear button on UITextView

两盒软妹~` 提交于 2020-01-10 14:18:21
问题 How can I add a clear button (cross inside a circle) for UITextView like UITextField has? 回答1: just make a uibutton and put it on uitextview and set its action for clear text view; uitextview.frame = (0,0,320,416); uibutton.frame = (310,0,10,10); [uibutton setimage:@"cross.png" forcontrolstate:uicontrolstatenoraml]; [uibutton addTarget:self action:@selector(clearButtonSelected:) forControlEvents:UIControlEventTouchUpInside]; -(void)clearButtonSelected{ uitextview=@""; } hope you want to clear

Clear button on UITextView

不问归期 提交于 2020-01-10 14:18:10
问题 How can I add a clear button (cross inside a circle) for UITextView like UITextField has? 回答1: just make a uibutton and put it on uitextview and set its action for clear text view; uitextview.frame = (0,0,320,416); uibutton.frame = (310,0,10,10); [uibutton setimage:@"cross.png" forcontrolstate:uicontrolstatenoraml]; [uibutton addTarget:self action:@selector(clearButtonSelected:) forControlEvents:UIControlEventTouchUpInside]; -(void)clearButtonSelected{ uitextview=@""; } hope you want to clear

Prevent default keyboard from showing when UITextField is pressed

戏子无情 提交于 2020-01-10 05:04:36
问题 Is there a way to make a custom keyboard to pop up when a user presses on a UITextField. I have a view with a custom keypad on it and I want that to come up when the user presses on the UITextField instead of the default apple keyboard. 回答1: Since iOS 3.2 there's a property for exactly that, called inputView. just go like this: [myTextField setInputView:myInputView] - where myInputView is obviously your custom input view. Then the system will pop up your view instead of the predefined

Prevent default keyboard from showing when UITextField is pressed

自闭症网瘾萝莉.ら 提交于 2020-01-10 05:04:25
问题 Is there a way to make a custom keyboard to pop up when a user presses on a UITextField. I have a view with a custom keypad on it and I want that to come up when the user presses on the UITextField instead of the default apple keyboard. 回答1: Since iOS 3.2 there's a property for exactly that, called inputView. just go like this: [myTextField setInputView:myInputView] - where myInputView is obviously your custom input view. Then the system will pop up your view instead of the predefined