views:

124

answers:

1

I am trying to conserve memory consumption in my visualization about. I have a scrollView with a containerView that contains some child views. I would like to eliminate the CALayer of the scrollView and containerView. So, just the child views consume memory during redraws, etc.

How do I do this?

Thanks, Doug

+3  A: 

All UIViews and UIView subclasses on the iPhone are backed by CALayers. There isn't really much you can do to avoid this because it's an assumption made by UIKit. (In Cocoa for Mac, you can specify which views have CALayers, though!)

While you might be able to hack a few things and destroy the CALayers of certain views, I wouldn't recommend it. I've written some pretty complex painting apps, and I've never had a problem with CALayers consuming large amounts of memory. Remember, you can safely use about 25MB of memory before your app receives a memory warning. If you're seeing your app churn through large amounts of memory used and you're just drawing, there's probably another problem.

Hope that helps,

Ben

Ben Gotow