uitextfield

Scrolling UITextField into view when keyboard is shown

筅森魡賤 提交于 2019-12-08 09:39:11
问题 I'm writing an app targeting iOS 6.1. I'm trying to follow this Apple doc on how to scroll a UITextField into view if it is obscured by the keyboard. The problem is that Apple's documented algorithm for calculating the scroll point doesn't work so well. My algorithm for calculating the scroll point works only slightly better, but is off by 70 pixels. What is the correct way to calculate the scroll point? Below you can see, from left to right, my view before the keyboard is shown, my view

iPhone: How can I make a UITextField invisible but still clickable?

删除回忆录丶 提交于 2019-12-08 09:16:03
问题 What I'm trying to do: In a simple UITableView, I've got a form with both text and dates/times that can be edited. I'm using UITextFields in the date/time cells too, so that the inputView property can be used to display a datePicker over the keyboard. What the problem is: The problem with this is that these UITextFields are really just dummy fields that show a datePicker when selected. When they're selected, they show this annoying blue cursor that blinks - but these are just dummy text

animating text box when clicked

↘锁芯ラ 提交于 2019-12-08 08:42:15
问题 I am trying to move a text box from the bottom of the screen in an iPad app so that the keyboard does not cover it. I have the following which works. -(void) textViewDidBeginEditing:(UITextView *) observationComment { observationComment.frame=CGRectMake(190, 100, 700, 250); } But 1 - I would like to animate the movement - is this possible? 2 - I get a warning Local declaration of 'observationComment' hides instance variable Any advice? Maybe this is not the best way to do it. 回答1: I

Can I limit the character set for a UITextField?

依然范特西╮ 提交于 2019-12-08 08:17:03
问题 I have a bitmap font which which doesn't have every single character, such as accented characters (é î ü etc) or symbols such as "¥" or © which I'm using to display usernames in a Highscore table for a game. Is it possible to limit the UIKit keyboard to certain characters, or only allow certain characters in the UITextField? Or will I have to roll my own input mechanism? I'm thinking and old school, Arcade style, one letter at a time "thing" would be ok. 回答1: You could try using the following

Text Field Should Return, is this correct for ios7?

可紊 提交于 2019-12-08 07:44:51
问题 I have searched and seen a lot of answers about textFieldShouldReturn method. Half of them are outdated, some work in different cases, some are not explained thoroughly. I am not sure what is the most optimal way to do this task, it works but I think there might be an easier way to do it. Heres my code so far: On the header file: @interface ClassName : SomeUIViewController <UITextFieldDelegate> In the implementation file: @interface ClassName() @property (weak, nonatomic) IBOutlet UITextField

Limit length of multiple UITextFields in Swift 2

时间秒杀一切 提交于 2019-12-08 07:17:10
问题 a solution to limit the length of a TextField but the function count has been updated, also count() function, so I don't understand how to use this: func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { let newLength = count(textField.text.utf16) + count(string.utf16) - range.length return newLength <= 10 // Bool } And how to update this to work on multiple TextField , I think I have to say if textField = thisTextField

sending Firebase value to text fields

丶灬走出姿态 提交于 2019-12-08 05:43:35
问题 I have a view controller with three text fields. When the user uses the app for the first time, they enter some information in those text fields and press done, then the information goes to Firebase database: FIRDatabase.database().reference().child("info").child(self.loggedInUser!.uid).setValue(saveObject) However, the user also has the ability to edit those three text fields. As of now, when the user edits one text field and clicks done. The information of the non-edited text fields appear

Adding additional string to message body (swift)

廉价感情. 提交于 2019-12-08 05:38:28
问题 I got my email working fine. The only thing i need to do is add an additional string to my message body. For example, I want to add Name: and textfield to my message body. Something like this. Name: John Smith Phone: 566-654-6577 Email: Smith@smith.com Right now, the message body only show the following. John Smith 566-654-6577 Smith@smith.com import UIKit import MessageUI class EmailTableViewController: UITableViewController, MFMailComposeViewControllerDelegate, UITextFieldDelegate {

How to you set the maximum number of characters that can be entered into a UITextField using swift?

社会主义新天地 提交于 2019-12-08 05:04:28
问题 How do you limit the number of characters in a UITextField to 10 , and if the user enters more than 10 , only record the first 10 characters? 回答1: This solution deals with a user pasting text or tapping delete key too. func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { let length = count(textField.text.utf16) + count(string.utf16) - range.length return length <= 10 } 回答2: You can check the text before it gets

iOS UITextField Underline Style in swift

半城伤御伤魂 提交于 2019-12-08 04:36:04
问题 I've added this image, I hope you can see it, of a user interface login. Notice the text field is transparent with the exception of the line at the bottom. What code do I put in to get that affect? Can I put the necessary information in the "user defined runtime attributes"? 回答1: Create a subclass of UITextField as below, And simply set this class in your storyboard to UItextField Swift 4.2 Support With @IBInspectable import UIKit class HSUnderLineTextField: UITextField , UITextFieldDelegate