Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 06-10-2010, 12:16 PM   #1 (permalink)
iPhun
 
Join Date: Jul 2009
Location: Oklahoma USA
Posts: 21
jharrah is on a distinguished road
Default Memory Management issues - other options

I have an app finished. When I wrote the app I didn't intend for it to become so .png overloaded. It is a quiz app and I have it working great, the problem is in the resource files (questions, answers, wrong answers,etc.) which are beginning to bog down launching the app with so many files. I have read and viewed tutorials but nothing seems to fit this type of situation - believe me I have tried everything. I have written the app programmatically and would like to use Core Data to store the files into a .plist or cxdata, but so far nothing seems to work. I'm sure it's something very simple and I just find myself stumped - writers block I guess? Is it possible to create a static UIView background and insert the text as needed per question/answer and still have the integer values for random questions, switching answers, etc. operate correctly? Here is an example of what I would like to manage better. Any help is greatly appreciated!!
Quote:
,
-(void)Game{

currentViewLocation = 250;
var_Score=0;
Questions_Count=0;





Questions=[[NSMutableArray alloc]init];
Image_Ans=[[NSMutableArray alloc]init];
Image_Wrong1=[[NSMutableArray alloc]init];
Image_Wrong2=[[NSMutableArray alloc]init];
Image_Wrong3=[[NSMutableArray alloc]init];
.......

,
for(int i=1;i<138;i++)
{

[Questions addObject:[UIImage imageNamed:[NSString stringWithFormat:@"KBCQ%d.png",i]]];
[Image_Ans addObject:[UIImage imageNamed:[NSString stringWithFormat:@"KBCC%d.png",i]]];
[Image_Wrong1 addObject:[UIImage imageNamed:[NSString stringWithFormat:@"KBCW%d.png",i]]];
[Image_Wrong2 addObject:[UIImage imageNamed:[NSString stringWithFormat:@"KBCWW%d.png",i]]];
[Image_Wrong3 addObject:[UIImage imageNamed:[NSString stringWithFormat:@"KBCWWW%d.png",i]]];


}

Last edited by jharrah; 06-10-2010 at 12:18 PM. Reason: tag
jharrah is offline   Reply With Quote
Old 06-11-2010, 11:54 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

Why do you need to load everything at once? I would load only 3 questions at a time, the previous, current and next question. Every time you show the next question, set the "current" to previous, next to current and load the next question (assynchronously while the user is reading/answering the current one).
It will be fast to load and will not hog resources.
nobre84 is offline   Reply With Quote
Old 06-11-2010, 12:32 PM   #3 (permalink)
iPhun
 
Join Date: Jul 2009
Location: Oklahoma USA
Posts: 21
jharrah is on a distinguished road
Default

Quote:
Originally Posted by nobre84 View Post
Why do you need to load everything at once? I would load only 3 questions at a time, the previous, current and next question. Every time you show the next question, set the "current" to previous, next to current and load the next question (assynchronously while the user is reading/answering the current one).
It will be fast to load and will not hog resources.
Thank you so much!!! That makes perfect sense and seems like a rather easy fix!! Obviously, I am not very familiar with Core Data so that would have been another project in itself. I normally deal with Audio/Video streaming (kinda my niche). I wanted to experiment with something "out of the box", and for me and this has been a great learning experience.

I would still like to learn more about Core Data (not for this project). Do you have any suggestions on some good tutorials that use anything besides tables...lol

Thanks again!!
jharrah is offline   Reply With Quote
Old 06-11-2010, 12:39 PM   #4 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

The place that really got me started with Core Data was this blog from the authors of the "iPhone in Action" book (a great book, if you can, definetely buy it)
They have a series of articles on Core Data that are so much more clear and "to the point" than the Apple documentation.
iPhone in Action: Core Data
nobre84 is offline   Reply With Quote
Old 06-11-2010, 01:53 PM   #5 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2010
Location: Issaquah, WA
Age: 42
Posts: 1,244
dljeffery is on a distinguished road
Default

You also probably want to use imageWithContentsOfFile: rather than imageNamed: , because imageNamed: caches images, which would increase your memory consumption.

Oh, and if you do get that book, Manning is actually running a discount code on the second edition of it ("iPhone and iPad in Action") right now (thru June 17). It's a work in progress, not complete, but if you buy the PDF you get updates along the way until it's complete, AND you get the full PDF of the first edition to tide you over until then. If you enter discount code "wwdc45" at checkout, you'll get it for 45% off, too.

Manning: iPhone and iPad in Action

Same discount code applies to a few other MEAP titles:
  1. iPhone and iPad in Action
  2. iPhone in Practice
  3. iPad in Practice
  4. Objective-C for the iPhone
  5. Building Location-Aware Applications
__________________
Recall It! Tag your notes. Tag your photos. Tag your thoughts. Tag your life.

Recall It! for iPad

http://www.dljeffery.com
dljeffery is offline   Reply With Quote
Old 06-11-2010, 02:48 PM   #6 (permalink)
iPhun
 
Join Date: Jul 2009
Location: Oklahoma USA
Posts: 21
jharrah is on a distinguished road
Default

Quote:
Originally Posted by nobre84 View Post
Why do you need to load everything at once? I would load only 3 questions at a time, the previous, current and next question. Every time you show the next question, set the "current" to previous, next to current and load the next question (assynchronously while the user is reading/answering the current one).
It will be fast to load and will not hog resources.
Works beautifully!!!! Thanks!!
jharrah is offline   Reply With Quote
Old 06-11-2010, 02:50 PM   #7 (permalink)
iPhun
 
Join Date: Jul 2009
Location: Oklahoma USA
Posts: 21
jharrah is on a distinguished road
Default

Quote:
Originally Posted by jharrah View Post
Works beautifully!!!! Thanks!!
Thanks so much for the references!! I really appreciate your help!! I will definitely download the book!! Time to branch out.......Thanks so much!!
jharrah is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 368
6 members and 362 guests
.Snipe, AragornSG, baja_yu, guusleijsten, hussain1982, Paul Slocum
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,645
Threads: 94,111
Posts: 402,862
Top Poster: BrianSlick (7,990)
Welcome to our newest member, leighec68
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:33 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0