views:

68

answers:

0

I try to do a magazine app containing a horizontal Scrollview with 15 Pages each containing a vertical ScrollView containing up to 15 Pages. For this I took apples Photoscroller-Example-Code (http://developer.apple.com/iphone/library/samplecode/PhotoScroller/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010080-Intro-DontLinkElementID_2). I "doubled" the PhotoViewController.m, so I have a PhotoVC.m (I called it PageVC.m) for the horizontal ScrollView which calls another PhotoVC.m (which I called ChapterVC.m) containing a vertical ScrollView and then this PageVC calls the ImageScrollView.m. Each Page has a Backgroundimage which seems to cause Problems. Now the Problem: In Simulator everything works (more or less) fine, but on Device after some scrolling I get Memory Warnings and after more scrolling the App crashes. When running with Leak Tool, after Some Scrolling I find a growing Number of Image Objects in Memory each holding 3.1MB. When I look before it crashes, I find probably 8-10 of the img_data-lock-Objects (I call them so). Of course I do not load the Images with imageNamed to avoid caching and better use initwithcontentsofFile. As I have nearly 200 Background Images for each Orientation, I think I have to take some care for the Memory Usage ;) Now the funny? thing: When I use png-Images with alphachannel, I always produce these img_data_lock-Beasts. It doesnt matter how big the png is - every 1024x768 image produces an img_data_lock-Object with 3.1 MB ! When I use png-Images without alphachannel, I dont find any of theses img_data_locks-Beasts and everything seems to work fine. Not just One img_data_lock in Memory! Believe me, I did a lot of googling in the last Months and seem to have read nearly everything about ScrollViews, pngs (alpha premultiplication...), Memory Mangement and so on, but could not find anything comparable to my Problem. Now the Question: Is there anyone whos knows something about this "png-alpha-channel"-Problem ? I know Apples own Photoapp does not have these Problems, so they seem to program somehow better than me ;) Right now I think Apples Photoapp might use OpenGl or something like this, but I probably will never know how they did it. Does someone has another Idea to tune up my Code ? I wanna say that I dont use the page displayTiledImageNamed-Method, but the page displayImage in the configurePage-Method. Also I dont find any Leaks when checking with the Build-Analyse-Tool.