uitextfield

Dimiss keyboard when editing textfield on UIWebview

被刻印的时光 ゝ 提交于 2019-12-06 09:34:52
I'm opening a web page on UIWebview and this page has a textfield and a virtual keyboard the to enter password. But when edit the textfield iPhone virtual keyboard appears as well. I wanted to dismiss iPhone keyboard and on the same time continue editing the textfield. I have tried the following but it did not work. [webView stringByEvaluatingJavaScriptFromString:@"document.activeElement.blur()"]; And also tried to register for Keyboard notification so I can dimiss the keyboard but did not succeed. I would appreciate any ideas about how to achieve this. Thanks in advance. [

How to implement newsfeed comment page similar to Facebook or Instagram

孤者浪人 提交于 2019-12-06 09:22:07
问题 Both Instagram and Facebook allow their users to comment on news feeds. In the comment scene, they basically have a UITableView with all the comments and a “footer” where user may enter comments and post them. So the “footer” is a UIView or UIToolBar with a UITextField/UITextView and a UIButton. Truly simple stuff from the look of it. Well I have been trying to implement it and the keyboard is not cooperating. I need the keyboard to not hide the “footer”. Especially now in iOS 8 the keyboard

remove the border of uitextfield in uisearchbar

好久不见. 提交于 2019-12-06 09:17:12
问题 I wanna custom the UISearchBar control to a style as showed in the picture below: First I should remove the background view, then find out the UITextfiled in UISearchBar, extend the frame of UITextfiled and remove the boarder of it. Here is my code : UITextField *searchField; NSUInteger numViews = [self.subviews count]; for(int i = 0; i != numViews; i++) { if([[self.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) { //conform? searchField = [self.subviews objectAtIndex:i]; } } if

How do I change the UITextField so it looks like the Search Text Field?

纵然是瞬间 提交于 2019-12-06 08:43:08
问题 I would like to change the standard iPhone UITextField so that it looks exactly like the search text field within the UISearchBar. You can see an example of this for the SMS text entry field within the iPhone Messages application. I do not believe that the UITextField has a style property that will meet this requirement. Any ideas? 回答1: If you want, you can actually extract the background image from a uisearch bar and make it a stretchable image to use as the background of a UITextField. I

How to detect that speech recogntion is in progress

纵饮孤独 提交于 2019-12-06 08:24:14
问题 Problem: I have UITextField side by side with UIButton with send functionality. When user presses send button I'm performing simple action: - (IBAction)sendMessage: (id)sender { [self.chatService sendMessage: self.messageTextField.text]; self.messageTextField.text = @""; // here I get exception } Now when user starts using dictation from keyboard, then presses done on dictation view (keyboard) and immediately presses send button, I've got exception "Range or index out of bounds". Possible

iPhone - UITextView should look like a UITextField

*爱你&永不变心* 提交于 2019-12-06 08:05:32
问题 I need a textfield so an user could write several lines. Unfortunately a UITextField does not provide several lines, so I think I have to use an UITextView. But the design of both are not the same. Is it possible to design the UITextView like the UITextfield standard with white background and rounded corners? Thanks a lot in advance & Best Regards. 回答1: In my self appointed role as interface-nazi, I feel compelled to point out that UITextField and UITextView have different appearances to

In Swift, how do you detect which UIControlEvents triggered the action?

一曲冷凌霜 提交于 2019-12-06 07:59:32
问题 I currently have 4 UITextField's @IBOutlet weak var fNameTextField: UITextField! @IBOutlet weak var lNameTextField: UITextField! @IBOutlet weak var emailTextField: UITextField! @IBOutlet weak var phoneTextField: UITextField! and I want to keep track of their various events: [UIControlEvents.EditingChanged, UIControlEvents.EditingDidBegin, UIControlEvents.EditingDidEnd ] but I don't want to have 3 event separate event handlers so I created a single function like this. This function does a

How do I animate changing the border colour of a UITextField?

别来无恙 提交于 2019-12-06 06:23:42
I infer from this question that the following should animate the colour change of my UITextField's border: [UIView animateWithDuration:5.0f animations:^() { myUITextField.layer.borderColor = [UIColor greenColor].CGColor; }]; But it doesn't, the border changes colour instantly. Is it obvious what I'm doing wrong? Update: Ok, so trying the following implicit animation : [CATransaction begin]; [CATransaction setValue:[NSNumber numberWithFloat:5.0f] forKey:kCATransactionAnimationDuration]; myUITextField.layer.borderColor = [UIColor greenColor].CGColor; [CATransaction commit]; And that doesn't

UIKeyboardWillShowNotification not calling and only UIKeyboardWillHideNotification calling in iOS 9

若如初见. 提交于 2019-12-06 06:13:42
问题 All is working good till iOS 8. But when user tap on text field control comes directly in UIKeyboardWillHideNotification notification Log in console -Can't find keyplane that supports type 4 for keyboard iPhone-PortraitTruffle-NumberPad; using 675849259_PortraitTruffle_iPhone-Simple-Pad_Default Here is the code-- ` In view did load - (void)viewDidLoad { [super viewDidLoad]; self.txtMobNumber.delegate = self; self.txtMobNumber.keyboardType = UIKeyboardTypeNumberPad; [[NSNotificationCenter

Weird behaviour of Caret/Cursor in UITextField

断了今生、忘了曾经 提交于 2019-12-06 06:08:50
(Xcode10.1 ,Swift, iOS 11&12) Question: How to increase height of caret/cursor in UITextField What i've tried so far: i've done this, and problem solved. class BPTextField: UITextField { override func caretRect(for position: UITextPosition) -> CGRect { //CGRect rect = [super caretRectForPosition:position]; var rect = super.caretRect(for: position) let h = self.frame.height - 5 let y_ = (self.frame.height - h)/2 rect.origin.y = y_ rect.size.height = h; return rect; } } but, when i changed Keyboard Language (from English-India to Japanese-Kana) and type single character , the caret/cursor moves