[iPhone] animationImages memory problem, better suggestion?

I have a view that I want to display some animation on. That view has an ImageView object that loads an array of PNG images into it's animationImages property. I load the images in the initWithNibName method. I want the animation to loop until the view disappears.
ivAnimation = [[UIImageView alloc] initWithFrame:self.view.frame];
ivAnimation.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"01.png"],
[UIImage imageNamed:@"02.png"],
[UIImage imageNamed:@"03.png"],
[UIImage imageNamed:@"40.png"], nil];
ivAnimation.animationDuration = 1.5;
ivAnimation.animationRepeatCount = 0;
[ivAnimation stopAnimating];
[self.view addSubview:ivAnimation];
I am getting memory warnings when the animation is playing. Eventually the application crashes. I don't see where I could be releasing anything to free up memory. All of the images are about 8KB. When I comment that code out everything runs smoothly. It makes me wonder if this is not the proper way to be doing animations. Since animated gif/png don't animate in an UIImage, how do you simulate that animation?

{quote}
SexyAndOhSoWitty wrote:
I created a blank View Project, and ONLY copied over the UIImageView setup and animation. It STILL throws memory warnings with 40, 8KB each, transparent PNG images loaded into the animationImages property.
{quote}
So here's the code:
.h
#import <UIKit/UIKit.h>
@interface AnimationTestViewController : UIViewController {
UIImageView *ivAnimation;
NSArray *animationBeginning;
@property (nonatomic, retain) UIImageView *ivAnimation;
@property (nonatomic, retain) NSArray *animationBeginning;
@end
.m
#import "AnimationTestViewController.h"
@implementation AnimationTestViewController
@synthesize ivAnimation, animationBeginning;
- (void)viewDidLoad {
NSLog( @"loadGame" );
// Initialization code
ivAnimation = [[UIImageView alloc] initWithFrame:self.view.frame];
animationBeginning = [NSArray arrayWithObjects:
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image01" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image02" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image03" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image04" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image05" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image06" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image07" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image08" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image09" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image10" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image11" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image12" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image13" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image14" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image15" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image16" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image17" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image18" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image19" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image20" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image21" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image22" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image23" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image24" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image25" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image26" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image27" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image28" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image29" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image30" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image31" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image32" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image33" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image34" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image35" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image36" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image37" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image38" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image39" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image40" ofType:@"png"]], nil];
ivAnimation.animationImages = animationBeginning;
ivAnimation.animationDuration = 2.0;
ivAnimation.animationRepeatCount = 0;
[ivAnimation stopAnimating];
[self.view addSubview:ivAnimation];
[animationBeginning release];
animationBeginning = nil;
- (void)viewWillAppear:(BOOL)animated {
[ivAnimation startAnimating];
- (void)viewWillDisappear:(BOOL)animated {
[ivAnimation stopAnimating];
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;
- (void)didReceiveMemoryWarning {
NSLog( @"didReceiveMemoryWarning..." );
if( [ivAnimation isAnimating] ){
[ivAnimation stopAnimating];
// If I do a release on animationImages there is EXCBADACCESS (I assume
// because I released the array earlier). This should minus that last retain.
ivAnimation.animationImages = nil;
[super didReceiveMemoryWarning];
- (void)dealloc {
[ivAnimation release];
[animationBeginning release];
[super dealloc];
@end
Same results of course

Similar Messages

  • TS3276 My o2 email account does not work when sending from my MAC it will accept incoming mail but not send it gives me a message that  o2 account (offline) my mac I have no problem with my iPhone  or mac laptop. any suggestions please.

    My o2 email account does not work when sending from my MAC it will accept incoming mail but not send it gives me a message that  o2 account (offline) my mac I have no problem with my iPhone  or mac laptop. any suggestions please.

    Sorry for the delay...
    I did what you've told me, new account and manually copied my files from Time Machine. I had lots of permissions problems, but at the end, almost everything is in order... It seems it had to be with some of the Apple Preferences, but I can't be sure, as most of them were dumped to the trash can.
    I still don't have my Mail Rules back, unfortunately, although I did goggled some. It is a pity, as I had around 30 or 40 of them, getting my mail in order to each of its mailboxes, but it is a small price as the rest doesn't show the before syntoms.
    Thanks for the help, anyway!!

  • My iphone's memory is near capacity from photo albums sync'ed with my mac and I haven't found out how to delete select albums without wiping the iphone.  Any suggestions??

    my iphone's memory is near capacity from photo albums sync'ed with my mac and I haven't found out how to delete select albums to free up memory without wiping the iphone.  Any suggestions??

    You do the opposite of how you got them on your phone, you unsync the pics using iTunes.

  • HT4623 I'm trying to update my iPhone 5 to IOS 7 through iTunes. I get a pop up saying I need to update my iTunes to  11.0.5 before I can update my iPhone. The problem is my iTunes is current, and no update for iTunes is found. Any one have any suggestion

    I'm trying to update my iPhone 5 to IOS 7 through iTunes. I get a pop up saying I need to update my iTunes to  11.0.5 before I can update my iPhone. The problem is my iTunes is current, and no update for iTunes is found. Any one have any suggestions?

    I had the same problem. My phone wasn't finding it so I tried plugging it into my laptop and it said I needed the latest iTunes which I already had.... I unplugged my phone from my laptop and did a soft reset to my phone (hold down the lock button and home button at the same time until your phone turns off) once it turns back on you should find the update... Click general... Software update. Worked for me!

  • Hello i have an iphone 5 it is very slow when i am downloading app my iphone 4 it is much much better are all the iphone 5 are the same or my iphone 5 have problem please

    hello i have an iphone 5 it is very slow when i am downloading app my iphone 4 it is much much better are all the iphone 5 are the same or my iphone 5 have problem please????

    Thank you for your help are you aware of any apps that will work the iso 4.2.1 system that will let you watch movies on the phone. Also I tried to down load something else the other day and got message that Safari wont let you open this is ther any to see if i have the latest safari on my phone?

  • Why  these features aren't  avaiable on iphone?Internal radio,Bluetooth(work with any mobile),Memory slot,Better internal memory( 512 MB),Fast processor,21Mbps HSDPA,Big display(feel da real experience of IOS)Will the next iphone resolve these issues ?

    Why  these features aren't  avaiable on iphone yet ?Internal radio, Bluetooth(work with any mobile), Memory slot, Better internal memory(>512 MB), Fast processor, 21Mbps HSDPA, Big display (feel the real experience of IOS) Will the next iphone resolve these issues ?

    For the same reason my car hasn't got in-dash satnav, leather upholstery or a six litre engine. Because that's how the manufacturer chose to make it. If you are unhappy with the specs, don't buy one.
    There is no information regarding any new iPhone.

  • Apple better fix this ios 6 iphone 4s wifi problem. alot of people are getting bloody ******. how do i fix this **** problem .

    apple better fix this ios 6 iphone 4s wifi problem. alot of people are getting bloody ******. how do i fix this **** problem .

    Celinaxoxo wrote:
    apple better fix this ios 6 iphone 4s wifi problem. alot of people are getting bloody ******. how do i fix this **** problem .
    Nah... there simply is not iOS 6 Wi-Fi problem with the 4S.  I have not experienced any issues and neither has anyone else I know with iPhones.
    User's like yourself really should drop the attitude and try some basic troubleshooting.
    FYI, this is a user to user forum and statements like yours are very likely to get removed for violating the Terms of Use of these forums.

  • Hi hello there is people saying that the iPhone 5s has problems. I want to know if the problems are fixed or is better to wait to December??

    Hi hello there is people saying that the iPhone 5s has problems. I want to know if the problems are fixed or is better to wait to December??

    What problem to people say the iphone 5s has?
    People claim problems with every product ever released.

  • Nokia C5-03 Low memory problems ( Other Files )

    Please help. I have a nokia C5-03 the handset is showing phone memory is full. I have checked and uninstalled all unecessay applications. But problem is still there. when i check the phone memory it indicates that i have other files of 42mb installed and using phone memory. however i am unable to check what other files are installed or classfied as other files. Can you please assist me so i can know what these other files consist of or where they are located.

    Hi Thetao,
    I typed a more extensive reaction before, but it got lost when I pressed "post". Therefore I just respond to the main points that you mentioned (and some I found out myself).
    Strange: I can't find the 40 MB Maximum User Storage on the Nokia website anymore (nor the 75 MB). But it sounds very familiar to me. It looks to me as if they removed this from the phone specs, also of other Smartphones by the way.
    Yesterday, I deleted some small apps that I don't use (anymore) such as InternetRadio and I also removed Nokia email. Although the apps were below 2 MB together, this freed up over 7 MB of Phone memory (24 MB free now)! I think there were still some old emails stored in C: which I couldn't delete any other way. This helped me a great deal already but I tried your suggestions as well.
    1. No map data or CITIES folder on C: 2. Switched messages memory to phone (and phone to offline mode) and I did indeed find a forgotten email account with 30 email messages. Not much but I had 24,7 MB free after that. Of course, I put messages memory back to the memorycard. 3. Used the free edition of Y-Browser to manually delete the cache folder. Not much data in that, but 25,1 MB free after that. Nice tool, with which you can reach folders that normally stay hidden! Used YBrowser to search all C: for files over 300 kB. Only 2 files: boot_space.txt in C:\ (500 kB, contains only the X repeatedly as far as I see, but is probably essential for the operating system) and C:\resource\python25\pyton25.zip (1 MB). It looks like an installation package, but I'm not sure if I can delete it. By the way: YBrowser hasn't made a shortcut in one of the menus. Only way that I found to start it was to look for it using the Phone's search function. Is there a way to make this shortcut myself?
    4. Yes I did. No Images folder on C: anymore, nor other big files (see point 3)
    5. I use Bluetooth for file transfer sometimes, mainly for installation files (such as YBrowser.sis, but I did this one via USB-cable). However, no big files are left on C: so I don't think I have this problem.
    6. I tried to delete Nokia Chat yesterday as well (with the other apps), but it won't be uninstalled the normal way as it says "Uninstall cancelled" (not sure about the exact translation since my phone 'speaks' Dutch) Do you know if there's another way to get rid of this 3 MB app that I don't use at all?
    I think I may have found an explanation and a solution for the memory problem while navigating. You mentioned the "memory in use" in the map settings. Above that option there's a slide bar for the % of memory that the navigation can use. Standard is 70%. I always thought this was about storage memory on (in my case) the memorycard. Another topic mentioned that this the working memory (so the RAM) that the navigation may use. Setting it to 70% means there's only 30% left for other apps that run in the background. The other topic states that this is nog enough so the slider should be set to for instance 30% for navigation leaving 70% free for "the phone". From behind my computer, navigation seems much more stable. I'll try this setting in my car soon and let you know how it works.
    Thanks a lot for thinking along with me so far! There's already 25,1 MB of space, which is great since it was only 7 MB last Sunday. And navigation looks more stable. I'd appreciate if you have some more answers to my latest questions, but if not I think my phone will work a lot better already!
    Regards, Paul

  • XCode freezes when opening project after installing iPhone SDK 3.2 beta

    I have problem opening up existing XCode projects, and creating new XCode projects.
    If I open an existing XCode project, no window appears and XCode becomes non-responsive.
    If I create a new XCode project, it shows me the window to create new project, but after entering the project name, XCode becomes non-responsive.
    I've played around with the settings and found out that if I go to
    Preferences>Code Sense and untick the Indexing>'Enable for all projects'
    The problem is solved. But with that turn, I no longer have auto-completion.
    I have tried a few methods to solve this but none was working
    1) I thought the problem was due to documentation. In Preferences>Documentation, I see "Mac OS X 10.6 Core Library" and "iPhone OS 3.2 Library" showing "Getting..." all the time. I compared the file sizes of the docsets to my laptop (no problem with XCode) and there's a big difference in file size. So I copied these files from my laptop to the Mac with problem. This does not solve the problem.
    2) Clear cache .
    3) Disable indexing. Quit XCode. Start XCode and enable indexing. Then quit XCode and start project.
    4) Uninstall XCode completely with sudo /Developer/Library/uninstall-devtools --mode=all , and then reinstall iphonesdk_3.0__snow_leopard_final. I verifed that I was able to open projects normally. Then I installed iphonesdk_3.1_with_xcode_3.2_final__snow_leopard_10a432, followed by
    iphonesdk_3.2_beta_with_xcode3.2.2. Problem comes back
    5) I tried to clear the files below but it does not help
    ~/Library/Preferences/com.apple.Xcode.plist
    ~/Library/Caches/com.apple.Xcode
    ~/Library/Caches/xcodebuild
    ~/Library/Application Support/Developer/Shared/Xcode/
    Anyone able to point me to a solution? Thanks

    Hello honcheng & welcome to discussions.
    I'd recommend doing a custom install during the iPhone OS 3.2 beta installation instead, and putting it into a separate location from the release tools...
    I would also suggest participating in the beta forums as well.

  • Memory problem on Msi x48c platinum

    Hi every body,
    I have a MSI x48c platinum mainboard,
    Recently i bought a ddr3 memory module (corsair CMX4GX3M2A1600C9) trying to upgrade my system,
    after replacing old memories with new ones, system didn't boot. Even bios setting page did not apear. So i installed old rams and by decreasing Dram frequensy at 1066MHz and then replacing old and new memories i managed to boot the system up and use the new modules.
    Now the question is that how i can use the maximum of ram frequency? Which setting do you recomend?
    I set everything else on auto at bios settings.
    If  you should know, i use an intel q9400 cpu.
    Here is an image of my bios setting page where all settings are shown:
    minus.com/lM5jHYAgmAwfI

    Quote from: badboy2k on 07-September-12, 22:58:03
    highest you will be able to use with your setup on the dimms will be 1333mhz with 2 dimms at timings of 9-9-9-24 command rate 2T at the most even if it boots at that frequency it may not be stable!
    With a frequency higher than 1066 MHz system can't boot,
    Quote from: xmad on 07-September-12, 22:59:26
    Try doing a full cmos clear >>Clear CMOS Guide<< after installing the new memory in the proper channel.
    By default that memory will operate at 1333 9-9-9-24 1t, see if it will boot after the cmos clear.
    There have also been allot of bios updates that provided for better memory support, i suggest seeing what version you have and flashing to the newest. (with your old ram installed to ensure stability.)
    I updated bios to last version (7.4), clearing cmos would default setting on bios thus system can't boot again.
    Quote from: flobelix on 07-September-12, 22:59:54
    Also try setting memory voltage to 1.65v and see if that works.
    Have been trying memory voltage up to 1.83v, but it didn't work with memory frequency higher than 1066...

  • I set up my iCloud account on iPad with an exchange account and aol account.  I can see exchange and aol emails but not those from .me account or apple email.  I got it to show all 3 accounts on my iPhone with no problem.  Hat am I missing?

    I set up my iCloud account on iPad with an exchange account and aol account.  I can see exchange and aol emails but not those from .me account or apple email.  I got it to show all 3 accounts on my iPhone with no problem.  Hat am I missing?

    I'm having a similar problem, but I do have the key and is not working anyway.
    My old pc was running on windows 7 and my new one is an apple running on Lion.
    My phone is an Iphone IV and I can see all the bookmarks there.
    In order to sync, what I did was click on the "I don't have the device with me", I entered the key that was provided and the process finish ok. It says congratulations, etc, etc.
    But the bookmarks are not there, I tried merging data and replacing data on this computer options but is the same.
    Any suggestions?

  • IPhone 3G Reception Problems? You're Not Alone

    I have the same problem with 3G coverage. I am suppose to be in a strong 3G coverage area at home. I only have 1 bar. Traveling around town (Sacramento area) my 3G coverage changes dramatically. From 1 bar to full bars? Not sure if its working properly or not??? Anyhow, this was posted on Engadget. After they exchanged their iPhone the problem went away? Could it be true? Is it the netork or our iPhones? Lets all hope nothing is wrong with our iPhones!!!!
    iPhone 3G Reception Problems? You're Not Alone
    One of the more disturbing things coming out of the iPhone 3G launch is reports of suspiciously poor 3G reception and speeds. Specifically, I've seen several people report one bar - specifically, one bar - of 3G reception in areas where other devices report strong reception. (More complaints at Engadget.)
    This may be a problem with a batch of iPhones, or with something in AT&T's network, though I've also seen someone reporting the problem on O2 in the UK. The first review iPhone we got had this problem - it would mysteriously drop from four bars of 3G to one for no apparent reason, while our Motorola RAZR2 V9 reported better reception. Then it would shoot back up to four bars for no apparent reason a few minutes later. That unit would also occasionally throw up an "invalid SIM" error, requiring a reboot. That phone also had hideously slow 3G data speeds in the 50 kbps-150 kbps range, so the missing bars weren't just a display issue; there was something wrong with the way the phone was hitting the network.
    We exchanged that iPhone for a different unit and no longer had the problem. We took the new iPhone and carried it around comparing it to a Motorola V9, and the two phones connected roughly the same number of calls on the 3G network. The new unit also had much higher data speeds in the same locations - still not great, in the 300-400 kbps range, but at least reflecting 3G.

    my white iphone does the same thing. I will drop down to one bar on 3g but full strength when i turn 3g off. Some people have tried to say that it is because 3g had more difficulty going through walls. Mine will not switch between 3g and edge on it's own so i find that when at home i just have to turn off the 3g. I have also heard rumors of a bad batch of iphones. I tried to take it into the store today but they were so busy i just had to make an appointment for thursday, although i was able to replicate the problem in front of the apple geek, which was a little surprising becuase while in line outside the store i had full bars of 3g. It might just be an issue that occurs when indoors? I also have a problem with lag. I'm hoping to get it resolved thurdays, whether they give me a new phone or just tell me to eff off and deal with it. probably the latter.

  • TS4006 When trying to find my ipod i get the message offfline.  However I have it with me and it is connected to the internet and the find my iphone is on.  Any suggestions?

    When trying to find my ipod i get the message offfline.  However I have it with me and it is connected to the internet and the find my iphone is on.  Any suggestions?

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • E62 file manager & memory problem

    Hello
    I have an E62 from cingular, with a 2-gig extended memory.
    I have a problem with invisible data -- mostly email messages -- that are using up all but 80 mb of the phone memory.
    It appears I mucked things up by uninstalling blackberry connect and then reinstalling it to the 2gig extended memory card. There are still messages somewhere on the phone memory but I cannot access them. There are some other things too, but absolutely no data shows up in folders through file manager. It's as if all files are empty, this is true for both phone memory and the extended memory and has been since I got the phone -- it didn't raise any questions for me because I didn't quite understand the OS and I had not yet added much stuff to the phone then. But it seems to me that stuff ought to be visible. For example, I had created some audio files with the recorder. They were visible through the recorder software, but they did not turn up in file manager. So I'm wondering if that program even works.
    I would like to avoid resetting the phone completely, but if that is the only way to get rid of this invisible data, or to get file manager to work properly, I guess I'll have to do that. Has anyone ever had this problem? Suggestions?

    Try using the Y-Browser to access these files:
    http://www.allaboutsymbian.com/software/item/Y-Bro​wser_for_S60_3rd_Edition.php
    You would need to set the certificate check in the app-manager to not to validate the certificate to install this.

Maybe you are looking for