uitextfield

Warning about obtaining lock from other thread when accessing text field

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 05:49:02
问题 I have a UITextField named _passwordTextField , where I'm hiding the input: [_passwordTextField setSecureTextEntry:YES]; every time I access the field's text with passwordTextField.text , I see this warning: void _WebThreadLockFromAnyThread(bool), 0x9077460: Obtaining the web lock from a thread other than the main thread or the web thread. UIKit should not be called from a secondary thread. How do I remove this warning? 回答1: This has nothing to do with UITextField . iOS UIKit requires any

Manually setting “text” for a UITextField does not call .EditingChanged

萝らか妹 提交于 2019-12-13 05:48:44
问题 I have subclassed UITextField which has the target self.addTarget(self, action: "onChange:", forControlEvents: .EditingChanged) This works fine when the user is typing in the textfield. Although I would need to the same method "onChange:" to be called when the textfield's "text" property is manually updated. let tf = CustomTextField() tf.text = "Trigger !!!" How could I do this ? 回答1: This is intentional, to prevent endless echo if you need to change the text programmatically in an event

Keyboard won't close with UITextField

微笑、不失礼 提交于 2019-12-13 05:42:05
问题 In my code I have: -(BOOL)textFieldShouldReturn:(UITextField*)theTextField{ if (theTextField == ITload) { [ITload resignFirstResponder]; return YES; } if (theTextField == FacilitiesLoad) { [FacilitiesLoad resignFirstResponder]; return YES; } return NO; } ITload and FacilitiesLoad are both my text fields. I'm using Numerical with punctuation keyboard and no done key appears. I have a return key which doesnt close the keyboard down. Any ideas on how to display a done key and to get

How to set Minimum and Maximum limit to Uitextfield?

橙三吉。 提交于 2019-12-13 05:00:03
问题 i need to set minimum and maximum limit value to one single textfield i.e the number should start with minimum 2 digits and maximum 5 digits here i tried some methods -(BOOL)validatenumber:(NSString*)Number{ if ([Number length ]>=2) { return NO; } return YES; } 回答1: - (BOOL)textFieldShouldReturn:(UITextField *)textField { NSInteger inte = [textField.text intValue]; if (inte <5 && inte > 2) return NO; else return YES; } Swift override func textFieldShouldReturn(textField: UITextField) -> Bool

Keyboard hiding textfield in iPad

不问归期 提交于 2019-12-13 04:55:11
问题 Hi I had a problem that keyboard hiding UITextField in UIScrollView . For that I used some code from apple documents. In ViewDidLoad [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillBeHidden:) name:UIKeyboardWillHideNotification object:nil]; and - (void)keyboardWasShown:(NSNotification*)aNotification { int rowNumber=

UITextField Set Border

与世无争的帅哥 提交于 2019-12-13 04:50:29
问题 I want to make my login interface a little bit more fancy. So I wanted to build somethin like this: Thats what i Have to far: self.usernameTextField.layer.borderWidth = 1.0f; self.usernameTextField.layer.borderColor = [[UIColor colorWithRed:171.0/255.0 green:171.0/255.0 blue:171.0/255.0 alpha:1.0] CGColor]; self.usernameTextField.layer.cornerRadius = 5; self.usernameTextField.clipsToBounds = YES; self.passwordTextField.layer.borderWidth = 2.0f; self.passwordTextField.layer.borderColor = [

UITextField reusing text in UITextField randomly

…衆ロ難τιáo~ 提交于 2019-12-13 04:41:52
问题 This is an extension of this question here: UITextField randomly reusing text in tableview I'm having some issues with my table that has UITextFields in each cell. I notice text is still getting reused randomly in the wrong cells even though I seem to be saving it correctly. else if (tableView == self.vitalsTableView) { if ([indexPath row] == 2) { CellIdentifier = @"bloodPressureCell"; BloodPressureTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; cell

Do not pass cursor to next textfield without entering value in first textfield

风流意气都作罢 提交于 2019-12-13 04:35:39
问题 I have created textfields dynamically in UITableView I don't want to pass cursor without entering value in first textfield [self.playerTable.subviews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx,BOOL*stop) { UITableViewCell *cell = obj; if([cell isKindOfClass:[UITableViewCell class]]) { for(UITextField *textField in cell.contentView.subviews) { if([textField isKindOfClass:[UITextField class]]) { if ([textField isFirstResponder]) { [textField resignFirstResponder]; isEditMode = NO; if(

MFMailComposeViewController setToRecipients append String from settings textField trouble

冷暖自知 提交于 2019-12-13 04:33:48
问题 Hopefully this is a simple issue? But I just cant seem to get my head around it. I have a text field in my settingsViewController called emailText where I want to set the default email recipient. @IBOutlet weak var emailText: UITextField! override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { let shoppingListViewController = segue.destinationViewController as! ShoppingListViewController shoppingListViewController.emailString = ([emailText.text]!) } func

Class is not key value coding compliant

烂漫一生 提交于 2019-12-13 04:24:19
问题 I have a NavigationController , root view controller called "ViewController" and a second view controller called "SettingsViewController". I have a segue to the "SettingsViewController" from "ViewController" which worked until I tried to connect a UITextField called "usernameField" to the "SettingsViewController" by means of Reference Outlet. When I did I got the following error whenever I try to go to the SettingsViewController: *** Terminating app due to uncaught exception