uitextfield

uitextfield hide keyboard?

送分小仙女□ 提交于 2019-11-30 15:56:59
问题 On the iphone. When I press on the uitextfield I don't want a keyboard to popup. I want the same behavior, just no keyboard at all. How can I hide/close the keyboard when the user presses the uitextfield ? 回答1: If you want the exact same behavior, without the keyboard, try textfield.inputView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; 回答2: Returning NO to UITextFieldDelegate 's - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField should do it. 回答3: I think you can use

uitextfield hide keyboard?

牧云@^-^@ 提交于 2019-11-30 15:24:45
On the iphone. When I press on the uitextfield I don't want a keyboard to popup. I want the same behavior, just no keyboard at all. How can I hide/close the keyboard when the user presses the uitextfield ? If you want the exact same behavior, without the keyboard, try textfield.inputView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; Returning NO to UITextFieldDelegate 's - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField should do it. Asike I think you can use textfield resignFirstResponder in delegate method - (void)textFieldDidBeginEditing:(UITextField *) textField

Difference between textfieldshouldendediting and textfieldDidendediting in iPhone

*爱你&永不变心* 提交于 2019-11-30 15:22:47
问题 What is the difference between textFieldShouldendEditing and textfieldDidEndEditing , and when should each method be used? 回答1: textFieldShouldEndEditing : Asks the delegate if editing should stop in the specified text field. - (BOOL)textFieldShouldEndEditing:(UITextField *)textField Discussion This method is called when the text field is asked to resign the first responder status. This might occur when your application asks the text field to resign focus or when the user tries to change the

UITextField custom background view and shifting text

感情迁移 提交于 2019-11-30 15:02:15
I'm trying to use a custom textfield background. The problem is that the text then appears to be too close on the left. I don't see any way to shift the text without subclassing UITextField. So I'm attempting to extend and overwrite - (void)drawTextInRect:(CGRect)rect{ NSLog(@"draw rect"); CGRect newRect = CGRectMake(rect.origin.x+20,rect.origin.y,rect.size.width-20,rect.size.height); [super drawTextInRect:newRect]; } But for some reason the log never prints. I know the subclass is being used since I also have a log in the init, and that prints fine. Whast goig on EDIT. I also try - (CGRect

Creating a textfield with only bottom Line in Ios

不想你离开。 提交于 2019-11-30 14:39:01
问题 Is is possible to create a Textfield in Ios which shows only bottom border line and not upper and side lines. if Yes, how can i implement this 回答1: Yes it is possible. Here is how to do it: CALayer *border = [CALayer layer]; CGFloat borderWidth = 2; border.borderColor = [UIColor darkGrayColor].CGColor; border.frame = CGRectMake(0, textField.frame.size.height - borderWidth, textField.frame.size.width, textField.frame.size.height); border.borderWidth = borderWidth; [textField.layer addSublayer

UISearchBar custom corners

隐身守侯 提交于 2019-11-30 13:00:47
I'm trying to create a search bar like this: But I'm noticing that I'm probably going to have to replace the search bar with my own image because the search bar corners comes out wrong when I set: self.searchController.searchBar.layer.cornerRadius = 50 // I've tried other numbers besides this too with no luck self.searchController.searchBar.clipsToBounds = true If I set this: self.searchController.searchBar.layer.cornerRadius = self.searchController.searchBar.bounds.height/2 The search bar comes out like this: Which still isn't exact like in the image. Is there a way to replace the left and

UI

雨燕双飞 提交于 2019-11-30 12:58:21
UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(20, 60, 280, 70)]; //文本输入框,一般用作用户输入账号,密码,个人信息等 //添加输入成的事件监听 [tf addTarget:self action:@selector(valueDidChange:) forControlEvents:UIControlEventEditingDidEnd]; tf.placeholder = @"请输入帐号";//提示语,文本输入框,一般用于输入账号,密码,个人信息 [tf setValue:ColorHex_666666 forKeyPath:@"_placeholderLabel.textColor"];//提示语字体颜色 tf.textColor = ColorHex_333333;//输入时的字体颜色 tf.font = [UIFont systemFontOfSize:40];//文框标题的字体大小 tf.borderStyle = UITextBorderStyleLine;//边框风格 tf.backgroundColor = [UIColor redColor]; tf.background = [UIImage imageNamed:@"aaa"];//设置背景图片

Action of the “Go” button of the ios keyboard

故事扮演 提交于 2019-11-30 11:44:34
问题 How do I bind an action to the Go button of the keyboard in iOS ? 回答1: Objective-C Assuming you're using a UITextField, you could use the <UITextFieldDelegate> method textFieldShouldReturn . - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; // Dismiss the keyboard. // Execute any additional code return YES; } Don't forget to assign the class you put this code in as the text field's delegate. self.someTextField.delegate = self; Or if you'd prefer to use

Uppercase characters in UItextfield

跟風遠走 提交于 2019-11-30 11:44:19
问题 I have a question about iOS UIKeyboard . I have a UITextField and I would to have the keyboard with only uppercase characters. I use a storyboard and I tried to set the Cpitalization as " All characters " to UITextField properties . But this not solve my problem...any suggestion? 回答1: Set your textfield type autocapitalizationType to UITextAutocapitalizationTypeAllCharacters on the UITextField self.yourTexField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; After call

iOS 6 UITextField Secure - How to detect backspace clearing all characters?

坚强是说给别人听的谎言 提交于 2019-11-30 11:25:50
In iOS 6 if you type text into a secure text field, change to another text field, then come back to the secure text field and hit backspace, all of the characters are removed. I am fine with this happening, however, I am trying to enable/disable a button based on if this secure text field has characters in it or not. I know how to determine what characters are in the fields and if a backspace is hit but I am having trouble determining how to detect if clearing of all the characters is happening. This is the delegate method I'm using to get the new text of a field, but, I can't seem to figure