uitextfield

Why is UITextField animating on resignFirstResponder?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 23:30:13
Since iOS 8, UITextFields in a form behave very strangely. If I click an another text field or press Tab on the keyboard, the entered text animates upwards then reappears quickly. It happens every time after the view did loaded, and every now and then afterwards. It looks like this: My code looks like this: #pragma mark - <UITextFieldDelegate> - (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textField == self.passwordTextField) { [self loginButtonClicked:nil]; } else if (textField == self.emailTextField) { [self.passwordTextField becomeFirstResponder]; } return YES; } EDIT: It

How to find out what UITextField caused a UIKeyboardWillShowNotification?

孤者浪人 提交于 2019-12-03 23:28:01
I am trying to use a customized keyboard in my application, but I am hitting problems when trying to restrict it to one particular UITextField. I based my code on this Xcode project (originally found on this blog ). That code adds a custom UIButton (representing a 'decimal point') into the UIKeyboardTypeNumberPad keyboard view. It does it by subscribing to UIKeyboardWillShowNotification and modifying the keyboard when it appears. That Xcode project works great, but when I add an extra UITextField, the custom key gets put into the keyboard for that text field too, even though I have selected a

Add Placeholder to UITextField, how to set the placeholder text programmatically in swift?

你。 提交于 2019-12-03 23:08:10
I'm pulling out a phone number from a database, and when the user begins editing in the text field to change that phone number I'd like to use the number I currently have in the database as the placeholder. Since this information changes with each user, how can I set it programmatically in swift? You need to get the phone number from your database first (convert them to String), then you set placeholder of your textField to that String, like so textField.placeholder = phoneNumberString Swift 3 If your textField has text, you need to first set text property to nil, then set placeholder text:

keyboard not responding to resignFirstResponder

南楼画角 提交于 2019-12-03 22:11:32
问题 Instead of showing the keyboard I want to display a popover view when a textField is selected (my code is at the bottom). If the keyboard isn't showing then everything works great. However, if the keyboard is showing and then the textfield is selected the keyboard doesn't get dismissed, somewhere the firstResponders must be getting lost but I don't know where. Does anyone have a solution to this? My textfield: self.startDateTextField = [[UITextField alloc] initWithFrame:CGRectMake(79, 148,

Make UITextField which has a static and attributed prefix

十年热恋 提交于 2019-12-03 22:08:24
问题 I would like to make a UITextField , which has a static prefix and that the user cannot edit or delete, which at the same time is also attributed with a light gray font color. The editable part of the text field should always be shown in black color. An example is given below: It is essentially for typing in a user name, with a constantly prefixed domain. I have already tried using the textFieldShouldClear and textField:shouldChangeCharactersInRange:replacementString: delegate methods

How to call a method when the Done Button in the KeyBoard is Clicked?

落爺英雄遲暮 提交于 2019-12-03 21:49:10
问题 I want to call a method when the done button is clicked in the UITextField KeyBoard? Please Help me... 回答1: It's not even necessary to implement the delegate. I greatly prefer using good, old-fashioned target/action pattern to handle this. It can also lead to cleaner code if you have multiple ways of ending editing (say, intercepting touches outside the text field to cancel editing). To use target/action, simply wire up UIControlEventEditingDidEndOnExit , which shows up in Interface Builder

Fetching Values from textField in a custom cell iPhone

ぃ、小莉子 提交于 2019-12-03 21:17:53
I have a custom cell in a table View, see below. I have two textFields txt1 and txt2 in my custom cell, as seen below How can i access the values i enter in each of the text fields so that i can add the values in to seperate Arrays... the "Addset" button will increment the no of sections of the grouped table View there by incrementing the one more set. my table view code is as follows. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellID= @"catogoryCell"; CustomCell *cell = (CustomCell *)[tableView

iOS - Moving a UITextField to a Different Position when a UIView Moves

冷暖自知 提交于 2019-12-03 20:35:35
I have a main UIView which moves up by means of a switch. I have this working and there is no problem there. Now the UIView when down, takes up about half of the Screen and when it is pushed up it shows the bottom 40px. In the UIView when it is down it has a UITextField and it sits somewhere in the middle. When the UIView is pushed up I want that UITextField to move to sit within those 40px, so that it always accessible. This is the code I got for the UIView to move: -(IBAction)mainview:(id)sender{ if (uiSwitch.on) { label.text = @"Push Up View"; [UIView beginAnimations:@"animateView" context

Creating a UITextField that works like the iOS Mail's “To” field

老子叫甜甜 提交于 2019-12-03 20:25:17
问题 In iOS's Mail app, when you enter in the email of someone who is in your contact list it formats the text in an interactive bubble. I can't seem to find any obvious way to do this, and it's exactly what my app needs to do, and I'm not even sure where to start. Any pointers to where to look would be appreciated! 回答1: Looks like a duplicate of Is there an iPhone equivalent to the NSTokenField control? Short answer, no, nothing public. But there are 3rd party implementations, like

Increase UITextField to Certain Length

▼魔方 西西 提交于 2019-12-03 20:11:53
I have a UITextField that I would like to "automatically" adjust its bounds size in order to make space for the string added in the field. However, I would like it to max-out in terms of width at a certain amount. What is the best way that I can go about doing this? Thanks for any help. EDIT: TestingView.h #import <UIKit/UIKit.h> @interface TestingView : UIView <UITextFieldDelegate> { } @end TestingView.m #import "TestingView.h" @implementation TestingView - (void)awakeFromNib { CGRect testingBounds = self.bounds; testingBounds.size.width = testingBounds.size.width - 20; testingBounds.size