uitextfield

How to fixed text field position in all iphone device?

时光怂恿深爱的人放手 提交于 2019-12-11 02:52:39
问题 I am need set UITextField position fixed in all device screen. I want to set UITextField position fixed. Please Help me. Thanks. 回答1: Read this. It will help : Or refer to any auto layout tutorial. There are plenty online. 回答2: there are three types layout using in iOS autolayout Tutorial1,Tutorial2. if you are not interested in autolayout , go to second option autosizing Tutorial1,Tutorial2. autoresizingMask - here you can set height,width, x and Y coordinates programmatically Tutorial1

UITextField TapGesture doesn't respond on iOS 7.1

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 02:08:12
问题 I have a uitextfield which is programatically added to view. I need to show a UIPickerview, when i tap on that, I have added a UITapgestureRecognizer for that and user interaction also enabled. Which was working fine till IOS 7.0. But when i updated to IOS 7.1 which is not getting called. 回答1: Rather than setting a tap gesture for your textField , you can simply set the inputView of your textField as your pickerView . This simply enables you to show the UIPicker when the textField is tapped

How can I dismiss the keyboard programmatically?

自作多情 提交于 2019-12-11 01:58:56
问题 I need a way of determining the UITextField that is currently selected in a view. Is this possible without passing a reference or tag? To be more specific I need to be able to tell which UITextField is selected so that I can hide the keyboard. The reason I need this is because I want to create a UIToolbar to add to all the UITextField 's as an input accessory. On this UIToolbar I will add a 'Done' button, when pressed this should hide the keyboard for the currently selected UITextField . 回答1:

UITextfield issue with UIPicker view

假装没事ソ 提交于 2019-12-11 01:44:29
问题 Here is image of view I have following problem. I created a sample user information form for user. He fills some details and submits. See the first sub image in above screenshot. I am entering first name and last name here, normal keyboard will appear when I switch first name to last name manually by scrolling a view or by using keyboard next button on keyboard. Then, when click code textfield, a uipickerview/UIActionsheet will appear. Plase see previous image. It is working fine. When I move

How to use PhoneNumberFormatter class to format phone number in UITextField?

青春壹個敷衍的年華 提交于 2019-12-11 01:25:43
问题 I've been looking at a bunch of the threads here about trying to autoformat a UITextField into a phone number. I saw the links to Ahmed Abdelkader's PhoneNumberFormatter class ( http://the-lost-beauty.blogspot.com/2010/01/auto-formatting-phone-number.html ) But I don't understand how to actually implement it. I've got two UITextFields that I want to use with the class, in a form with many other UITextFields for other purposes. Ahmed's example is: UITextField *myTextField; int

Label in uitextfield left view not aligned with the text

此生再无相见时 提交于 2019-12-11 01:14:41
问题 I'm making a custom textField with a label in his left view but the text of the label is not aligned with the text/placeholder of the textField . Here my simple code: class mytextfield: UITextField { override init(frame: CGRect) { super.init(frame: frame) leftViewMode = .always let label = UILabel() label.text = "Hello" leftView = label } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func leftViewRect(forBounds bounds: CGRect) ->

Setting font for UITextfield place holder in swift

梦想的初衷 提交于 2019-12-11 01:12:55
问题 I used the following code for setting different font for UITextfield's text(16) and placeholder(9), m_searchTextField.font = UIFont .systemFontOfSize(16) let font = UIFont .systemFontOfSize(9) let attributes = [ NSForegroundColorAttributeName: UIColor.lightGrayColor(), NSFontAttributeName : font] m_searchTextField.attributedPlaceholder = NSAttributedString(string: "Search String be in meddle left", attributes:attributes) Font size is set correctly, but the placeholder text sets somewhat upper

resignFirstResponder to UITextViews on UITableViewCells that are no longer on screen

你说的曾经没有我的故事 提交于 2019-12-11 00:53:56
问题 I have a UITableView with a whole bunch of custom UITableViewCells in it. Each of these UITableViewCells has a UITextView in them. The problem I'm having, is that if the user touches a UITextView , that becomes the firstResponder and the keyboard pops up. If the user then scrolls down to a point where the UITableViewCell that the firstResponder is on is no longer on the screen, I can't get at the UITextView to dismiss it. I've tried holding (and retaining) a reference to the UITextView , but

magnifying glass displaying irrelevant content in UITextField

两盒软妹~` 提交于 2019-12-11 00:39:20
问题 I have developed an iOS app in Xamarin. I have few UITExtFields in UIScrollview. when user touch on UITetField, I am setting contentOffSet of scrollview so it can be visible when keyboard appears. this.txtUsername.ShouldBeginEditing += delegate { scrl.SetContentOffset (new CoreGraphics.CGPoint (0, this.txtUsername.ShouldBeginEditing.Frame.Location.Y - 50),true); return true; }; This works fine. But when I long press on textField, Magnifying glass is appearing and displaying irrelevant detail.

How to programmatically select a UITextField for editing

僤鯓⒐⒋嵵緔 提交于 2019-12-11 00:36:12
问题 I have a UITextField that I need to select programmatically so when the user taps on a date in a UIDatePicker, it will be sent to that UITextField. This is the code I have, which does not select the UITextField; I have tried all possible combinations of UIControlEvent , but none of them work. Any other ideas? // set textField parameters if([whichTextField isEqualToString:@"oStartTime"]) { oStartTime.backgroundColor = [UIColor colorWithRed:252.0/255.0 green:255.0/255.0 blue:197.0/255.0 alpha:1