uitextfield

Disappearing UITextField text

岁酱吖の 提交于 2019-12-04 03:01:37
问题 The issue I am having is that text in a UITextField disappears every other keyboard tap on iOS. This issue has happened in multiple view controllers, but previously I have been able to resolve the issue by making the textfield taller, giving it more room to draw the text inside. That solution is not working for this particular situation. I am using a custom font for my app, so I have used a subclass of UITextField for the text fields that automatically sets the custom font. I have tried

Sum of 3 UITextField? [closed]

本小妞迷上赌 提交于 2019-12-04 02:42:56
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . https://ibb.co/nH38wG Why the result is 123 and not 6 ? Anyone is able to elaborate and explain it to me please? 回答1: You are adding the text ( String ) values to each other in the label text. You should do this instead: guard let num1 = Int(textField1.text), let num2 = Int(textField2.text), let num3 = Int

Return Inputs to UITextfield with custom inputView

霸气de小男生 提交于 2019-12-04 02:35:32
问题 i created a UITextField and a custom View. after that i added this custom view as "inputView" to my UITextField. amountKeyboardViewController *amountKeyboard = [[amountKeyboardViewController alloc] initWithNibName:@"amountKeyboardViewController" bundle:nil]; amountTextField.inputView = amountKeyboard.view; [amountTextField becomeFirstResponder]; this works quite fine. but can i fill my "amountTextField" with the input clicked in my custom View (UIButtons)? thanks for some hints ! 回答1: in your

How to disable text-autocorrection for an UITextField or keyboard? [duplicate]

浪子不回头ぞ 提交于 2019-12-04 02:03:15
This question already has an answer here: Disable auto correction of UITextField 6 answers I have a case where autocorrection NEVER makes any sense. It's incredibly annoying. Can I disable it for the UITextField? With Interface Builder you can disable "Correction" in the "Attributes" Tab in Inspector. Programmaticaly you can use UITextField* textfield = [[UITextField alloc] init]; textfield.autocorrectionType = UITextAutocorrectionTypeNo; 来源: https://stackoverflow.com/questions/3802389/how-to-disable-text-autocorrection-for-an-uitextfield-or-keyboard

All the alert dialog message and textField have been changed to single line. Please checkout the image

邮差的信 提交于 2019-12-04 01:07:26
问题 Previously all the dialog and textField are working well. But not I do not know how these TextFields are suddenly changed to single line with triple. (Like some Message here...) let alert = UIAlertController(title: "Cancel Booking !!", message: "Are you sure you want to cancel your booking?", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "No", style: .default, handler: nil)) alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: self.cancelMessageDialog)) self

UITextPosition in UITextField

北战南征 提交于 2019-12-04 00:51:53
Is there any way for me to get at a UITextField's current caret position through the text field's UITextRange object? Is the UITextRange returned by UITextField even of any use? The public interface for UITextPosition does not have any visible members. I was facing the same problem last night. It turns out you have to use offsetFromPosition on the UITextField to get the relative position of the "start" of the selected range to work out the position. e.g. // Get the selected text range UITextRange *selectedRange = [self selectedTextRange]; //Calculate the existing position, relative to the

Adding a cancel button to UITextField keyboard

假装没事ソ 提交于 2019-12-04 00:32:36
问题 Is there a way to add a cancel button to the keyboard displayed for UITextField ? Looking over the UITextInputTraits Protocol Reference, I could not find anything, including trying out the different keyboard types. 回答1: You can create a input accessory view which can display a UIToolBar Above the keyboard and then add a cancel button to this. Take a look at the documentation link below for the inputAccessoryView property. http://developer.apple.com/library/ios/#documentation/uikit/reference

How can I move the clear button in a UITextField?

混江龙づ霸主 提交于 2019-12-04 00:32:15
For some reason, when I add a UITextfield as a subview of the contentview of a tablecell, the clearbutton does not align with the text typed in the field, and appears a bit underneath it. Is there any way I can move the text of the clearbutton to stop this from happening? Thanks for any help, I haven't seen this, and a screen shot would be helpful. But, the quick answer is that you can inspect the subviews array of the UITextField, find the subview that contains the clear button, and adjust its frame.origin. Edit: It seems I've been downvoted for this answer (written in 2010). This is of not

UITextField placeholder string is always Top aligned in ios7

假如想象 提交于 2019-12-04 00:30:58
I have subclass the UITextField class and did the below code - (void)drawPlaceholderInRect:(CGRect)rect { [self.placeHolderTextColor setFill]; [self.placeholder drawInRect:rect withFont:self.placeHolderFont lineBreakMode:NSLineBreakByTruncatingTail alignment:NSTextAlignmentLeft]; } I have also written self.contentVerticalAlignment = UIControlContentVerticalAlignmentTop; line of code This placeholder text is properly center aligned in ios6 but not in ios7 it is showing top aligned. Although text I type is appearing centered.It only has issue with placeholder string. I have tried with xib to set

How to set the color of the place holder text for a UITextField while preserving its existing properties?

怎甘沉沦 提交于 2019-12-04 00:07:13
I have seen some answers that show how to change the placeHolder text color for UITextField by overriding the drawPlaceholderInRect: method such as this one: iPhone UITextField - Change placeholder text color but that does not maintain the existing attributes such as alignment, font, etc...what is a better way to solve this? Forrest From iOS 6, Without any subclassing, one can accomplish this with a couple lines of code like so: UIColor *color = [UIColor blackColor]; textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholderText attributes:@