Re: The Case of the Dancing Keyboard
Re: The Case of the Dancing Keyboard
- Subject: Re: The Case of the Dancing Keyboard
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Tue, 28 Apr 2015 09:46:37 +0700
> On 27 Apr 2015, at 19:04, Alex Zavatone <email@hidden> wrote:
>
> By any chance is the searchBar wired through an IBOutlet?
>
> If so, do you have two connections to it?
No, it is not connected to any IBOutlets.
The reason is simply: programmer error.
When I click in the searchBar the following happens:
42:38.530 -[MasterViewController searchBarTextDidBeginEditing:] searchBar 0x7a79a810 isFirstResponder YES
42:38.530 -[MasterViewController presentSearchController:] searchBar 0x7a79a810 isFirstResponder YES
42:38.530 -[MasterViewController willPresentSearchController:] searchBar 0x7a79a810 isFirstResponder YES
42:38.536 -[MasterViewController searchBarShouldEndEditing:] searchBar 0x7a79a810 isFirstResponder YES
42:38.536 -[MasterViewController searchBarShouldEndEditing:] searchBar 0x7a79a810 isFirstResponder YES
42:38.537 -[MasterViewController searchBarShouldEndEditing:] searchBar 0x7a79a810 isFirstResponder YES
-[ResultsTableController scrollViewDidScroll:] rows: (none) - (none).
-[ResultsTableController scrollViewDidScroll:] rows: (none) - (none).
-[ResultsTableController scrollViewDidScroll:] rows: (none) - (none).
42:38.858 -[MasterViewController didPresentSearchController:] searchBar 0x7a79a810 isFirstResponder YES
I had in scrollViewDidScroll:
[searchBar resignFirstResponder ];
because I wanted the keyboard not to obscure the list when the user scrolls the tableView.
I did not anticipate that scrollViewDidScroll: is also called when nobody actually scrolls the tableView (which is quite empty at this point).
Once I fixed this, everything went back to normal.
Sorry for the noise.
Gerriet.
> On Apr 27, 2015, at 2:04 AM, Gerriet M. Denkmann wrote:
>
>>
>>> On 23 Apr 2015, at 12:04, Gerriet M. Denkmann <email@hidden> wrote:
>>>
>>>
>>> An UITableViewController with an UISearchController in iOS 8.3
>>>
>>> When I click in the SearchBar the following dance happens:
>>> Keyboard comes;
>>> Keyboard goes away;
>>> Background becomes gray;
>>> Keyboard comes again and now stays.
>>>
>>> This is sort of difficult to see in the Simulator because it happens too fast.
>>> But clearly seen (and rather annoying) on iPhone 4s.
>>>
>>> Any ideas how this silly dance can be avoided?
>>>
>>> Gerriet.
>>
>> Further investigation shows:
>>
>> In my app with the dancing keyboard I see:
>>
>> Click in SearchBar → Keyboard appears and vanishes again
>> 42:38.530 -[MasterViewController searchBarTextDidBeginEditing:] searchBar 0x7a79a810 isFirstResponder YES
>> 42:38.530 -[MasterViewController presentSearchController:] searchBar 0x7a79a810 isFirstResponder YES
>> 42:38.530 -[MasterViewController willPresentSearchController:] searchBar 0x7a79a810 isFirstResponder YES
>> 42:38.536 -[MasterViewController searchBarShouldEndEditing:] searchBar 0x7a79a810 isFirstResponder YES
>> 42:38.536 -[MasterViewController searchBarShouldEndEditing:] searchBar 0x7a79a810 isFirstResponder YES
>> 42:38.537 -[MasterViewController searchBarShouldEndEditing:] searchBar 0x7a79a810 isFirstResponder YES
>> * 42:38.539 -[MasterViewController searchBarShouldEndEditing:] searchBar 0x7a79a810 isFirstResponder YES
>> * 42:38.542 -[MasterViewController searchBarTextDidEndEditing:] searchBar 0x7a79a810 isFirstResponder NO
>> * 42:38.858 -[MasterViewController didPresentSearchController:] searchBar 0x7a79a810 isFirstResponder NO
>>
>> Click again to make Keyboard appear:
>> 43:15.282 -[MasterViewController searchBarTextDidBeginEditing:] searchBar 0x7a79a810 isFirstResponder YES
>>
>> The lines marked with “*” differ from those below.
>>
>> In another app (TableSearchwithUISearchController) I see:
>>
>> Click in SearchBar → Keyboard appears
>> 47:02.041 -[APLMainTableViewController searchBarTextDidBeginEditing:] searchBar 0x7d5ad7d0 isFirstResponder YES
>> 47:02.041 -[APLMainTableViewController presentSearchController:] searchBar 0x7d5ad7d0 isFirstResponder YES
>> 47:02.041 -[APLMainTableViewController willPresentSearchController:] searchBar 0x7d5ad7d0 isFirstResponder YES
>> 47:02.046 -[APLMainTableViewController searchBarShouldEndEditing:] searchBar 0x7d5ad7d0 isFirstResponder YES
>> 47:02.047 -[APLMainTableViewController searchBarShouldEndEditing:] searchBar 0x7d5ad7d0 isFirstResponder YES
>> 47:02.047 -[APLMainTableViewController searchBarShouldEndEditing:] searchBar 0x7d5ad7d0 isFirstResponder YES
>> 47:02.368 -[APLMainTableViewController didPresentSearchController:] searchBar 0x7d5ad7d0 isFirstResponder YES
>>
>> Somehow I seem to have messed up my searchBar: there is an additional searchBarShouldEndEditing + searchBarTextDidEndEditing (which seems to call resignFirstResponder, which removes the keyboard).
>>
>> I tried to follow all steps in my app same as TableSearchwithUISearchController.
>>
>> Any ideas?
>>
>> Gerriet.
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden