Re: iPhone UISearchDisplayController how to handle memory warning
Re: iPhone UISearchDisplayController how to handle memory warning
- Subject: Re: iPhone UISearchDisplayController how to handle memory warning
- From: Donald Largen <email@hidden>
- Date: Mon, 03 Jan 2011 13:24:56 -0600
Thanks for the reply. I actually had the same idea to start with something simple to recreate the problem. One of those ideas that come to you .5 secs after you hit the send key. I eventually resolved the issue. I did indeed need to handle the memory warning in the ViewController that managed UISeachDisplayController. When this occurs I need to save off the current search text, release the current instance of UISearchDisplayController, and create a new instance. Releasing and recreating was the only way I could get the views to behave properly. Then in the ViewDidLoad set the saved off search text on UISearchBar. This actually performs the search as if the user typed in the text.
On Jan 2, 2011, at 3:20 PM, Matt Neuburg wrote:
> On Sat, 01 Jan 2011 10:36:01 -0600, Donald Largen <email@hidden> said:
>> Here is my situation. I have UIViewController, call it ViewControllerA, that contains an UITableView and UISearchDisplayController. ViewControllerA is the root view controller in a UINavigationController. Things seem to work OK, that is I can preform a search, display the results, and select a row and push a detail view controller onto the stack, call it ViewControllerB.
>>
>> The problem I am having is when ViewControllerB is displayed I am getting a memory warning. When I navigate back to ViewControllerA the UISearchDisplayController did something in response to the memory warning. The search bar is gone, the search results table view is gone, the navigation bar is gone, and the "source table view" is displayed but has been scrolled to the top of the screen.
>>
>> I am thinking I need to handle this memory warning by recreating the UISearchDisplayController but I am not sure. I have a feeling though I am not doing something right in my setup of the UISearchDisplayController.
>
> That's certainly possible, but since you don't show how you set up the UISearchDisplayController, it's impossible to say more. However, in your position here's what I would do: create a completely new minimal project consisting of nothing but a UINavigationController with two UIViewControllers, the first of which has the UISearchBar controlled by the UISearchDisplayController. Now convince yourself that this minimal project does / does not have the problem you describe. If it doesn't, you know it's due to something else you're doing differently in the real project. m.
>
> --
> matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.apeth.net/matt/default.html#applescriptthings
_______________________________________________
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