问题
I am currently using this excellent solution from @yonel to make something similar to the FourSquare venue detail page. Within my storyboard I have this:
The problem is: because the scroll is a bit laggy, when I scroll fast I get a "Received memory warning." message in my console. The curious thing is that if I remove all of the labels and buttons inside the UIView
(just below the Map View
), everything works fine.
Any idea what could be wrong?
回答1:
As the above posters mentioned, it is difficult to give you any authoritative information without actually seeing some code for your project - and I'm aware that you have already found a workable solution. However, in case other users find this question with similar responses:
The nature of the error message suggests that you probably had some kind of memory leak in your application. The best way to start debugging this kind of problem is to use the Memory analysis tools found in Instruments.app
. For some detailed information on how to do this, take a look at this link from the Apple Developer site.
Especially if some of the items which are scrolling on or off the screen have graphical information (background images, etc) associated with them - destroying things which are off-screen might help improve performance. You will, of course, then have to re-create the items in question when they come back on-screen.
If the above doesn't help, take a look at some of the following questions/answers, which provide insight into other problems where this error occurs. Perhaps your issue is/was related:
- Unknown reason to receive Memory Warning
- Too many graphics open
- Not using Lazy-Loading
- Iphone App crashing due to Received memory warning even if i am releasing
- Check that
Zombies
isn't turned on (crashes faster in low-memory devices)
- Check that
- I received memory warning and my app crashed. Does it kill autorelease objects?
- Improper allocation/release of objects and their scope
回答2:
Unfortunately after days of searching, I could not find a solution. But I managed to find something to replace what I have, using UITableView
.
I found this ParallelView for UITableView: https://github.com/zhigang1992/ZGParallelView
Thanks for all the answers.
回答3:
I'm not familiar with the Venue Detail view in Foursquare, however I don't think we can help you with this without seeing some code.
At a glance, I notice there's another view there you haven't expanded. Perhaps something heavy in there, but again I think you need to show some code for those views, cause its more likely you're performing some memory intensive task and that's causing the issue.
Preferably if you could the scrollViewDidScroll method too :) I'll do my best to take a look once you've posted something. Or you can contact me directly with sample code if you don't want to post it here publicly.
回答4:
Received memory warning ,this warning displayed in the console once when i was testing in device .But when I closed the idle apps the error went away.So try removing apps running in background and try again .If it exist I think the issue is that when you use the scroll some kind of memory leak from the map tiles or something. Use instruments and analyse if there is some memory leaks.
This may help you
memory-management-in-objective-c-tutorial
来源:https://stackoverflow.com/questions/16123661/issues-with-map-behind-uiview-similar-to-foursquare-venue-detail