first-responder

iphone UISearchBar Done button always enabled

倖福魔咒の 提交于 2019-11-27 11:50:20
问题 I have a UIViewController with a UISearchBar. I have replaced the Search Button by a Done button. However, when one taps on the searchbar, the Done button is initially disabled. This occurs until one enters any character. What I want to do is to have this Done button always enabled, such that if i tap on it i can inmediately dismiss the keyboard. Any help? it would be highly appreciated. I have on my UIViewController -(BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { return YES; }

iOS app “next” key won't go to the next text field

南楼画角 提交于 2019-11-27 09:45:01
问题 I have a simple scene (using storyboard in IB) with a Username and Password text box. I've set the keyboard to close when you are on the Password text field but can't get the next(return) button to work on the Username to switch the focus (or First Responder) to the Password text box. I'm closing the keyboard while on the Password text field like this: - (BOOL)textFieldShouldReturn:(UITextField *)theTextField { if (theTextField == self.textPassword) { [theTextField resignFirstResponder]; }

UIWebView with contentEditable (html editing), first responder handling?

£可爱£侵袭症+ 提交于 2019-11-27 04:33:23
I'm making an html editor component for an app (using UIWebView with contentEditable in iOS 5.0), and got stuck at how to handle UIWebView first responder status [webView isFirstResponder], [webView becomeFirstResponder] and [webView resignFirstResponder] don't seem to work, and i've no idea how to make the webView become or resign it by code If anyone knows how to work this out i would be very grateful, thanks in advance! Here is how I overwrite these methods in a UIWebView subclass ( content is the id of the editable element): -(BOOL)resignFirstResponder { [self setUserInteractionEnabled:NO]

“First Responder” - Did I get that right?

梦想与她 提交于 2019-11-26 19:12:06
问题 Let me summarize this shortly: A "First Responder" in a nib file is an object, which represents the UI control element that has the user's focus. So if the user clicks on a control, the nib sets that clicked UI control as First Responder. In my app I could make an outlet to that "First Responder" from the nib, so that I could for example send a message "make red font color" to whatever the user has activated by clicking. And then, if this First Responder UI control does not understand that

UIWebView with contentEditable (html editing), first responder handling?

流过昼夜 提交于 2019-11-26 11:14:51
问题 I\'m making an html editor component for an app (using UIWebView with contentEditable in iOS 5.0), and got stuck at how to handle UIWebView first responder status [webView isFirstResponder], [webView becomeFirstResponder] and [webView resignFirstResponder] don\'t seem to work, and i\'ve no idea how to make the webView become or resign it by code If anyone knows how to work this out i would be very grateful, thanks in advance! 回答1: Here is how I overwrite these methods in a UIWebView subclass

iPad keyboard will not dismiss if modal ViewController presentation style is UIModalPresentationFormSheet

自闭症网瘾萝莉.ら 提交于 2019-11-25 23:27:59
Note: See accepted answer (not top voted one) for solution as of iOS 4.3. This question is about a behavior discovered in the iPad keyboard, where it refuses to be dismissed if shown in a modal dialog with a navigation controller. Basically, if I present the navigation controller with the following line as below: navigationController.modalPresentationStyle = UIModalPresentationFormSheet; The keyboard refuses to be dismissed. If I comment out this line, the keyboard goes away fine. ... I've got two textFields, username and password; username has a Next button and password has a Done button. The

Get the current first responder without using a private API

吃可爱长大的小学妹 提交于 2019-11-25 22:40:49
问题 I submitted my app a little over a week ago and got the dreaded rejection email today. It tells me that my app cannot be accepted because I\'m using a non-public API; specifically, it says, The non-public API that is included in your application is firstResponder. Now, the offending API call is actually a solution I found here on SO: UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; UIView *firstResponder = [keyWindow performSelector:@selector(firstResponder)]; How do I get