Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please can anyone help me? #46

Closed
SergeyOleynich opened this issue Oct 24, 2014 · 6 comments
Closed

Please can anyone help me? #46

SergeyOleynich opened this issue Oct 24, 2014 · 6 comments
Labels

Comments

@SergeyOleynich
Copy link

I'm trying to use FLAnimatedImage to show 84 gif in collection view. But i can't do this my app perfect work in simulator but doesn't work on real device. I had next code:
const int NUMBER_OF_GIFS = 84;
@Property (strong, nonatomic) FLAnimatedImage *gifImage;

            for (int i = 0; i < NUMBER_OF_GIFS; i++) {
                self.gifImage = [[FLAnimatedImage alloc] initWithAnimatedGIFData:[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%i", i] ofType:@"gif"]]];

         [self.gifsArray addObject:self.gifImage];
         self.gifImage = nil;
     }
  • (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
    {
    CellForGif *cellForGif = [collectionView dequeueReusableCellWithReuseIdentifier:@"CellForGif" forIndexPath:indexPath];
    cellForGif.gifImage.animatedImage = [self.gifsArray objectAtIndex:indexPath.row];
    [cellForGif.gifImage stopAnimating];
    return cellForGif;
    }
@MrBendel
Copy link

You'll have to be more specific about what's not working when you run on device vs simulator.

@SergeyOleynich
Copy link
Author

When i launch on device i receive a memory warning. All my gifs are in my NSMutableArray. When I begin scroll it scrolling for 2 or 3 seconds and then crash.
But sometimes my app can't ever put all my gifs in array it's also crash with memory warning.

@raphaelschaad
Copy link
Collaborator

You'll have to do smarter on-demand loading of your GIFs. Do you really need all 84 in memory at the same time? Even with regular images, that would likely crash your device (try it out with 84 static JPGs).

@SergeyOleynich
Copy link
Author

Please raphaelschaad can you give me your email? I will send you my code and if you have a free time maybe you will look at it? sergeyoleynich@gmail.com
Also I have another array with 234 static image (jpg). It's work fine without array with gif, but when I try to use two array together it's crash. Maybe I should manually free memory, but I don't know how (I am use ARC and think that memory will be free automatically)

@raphaelschaad
Copy link
Collaborator

Hey Sergey, I'm afraid this is not the right forum for assistance with those broad problems as it doesn't seem to be an issue with FLAnimatedImage. For general help, I recommend looking at http://stackoverflow.com or http://devforums.apple.com

Good Luck!

@SergeyOleynich
Copy link
Author

Ok, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants