matteogobbi / MGSpotyViewController

Beautiful viewController with a tableView and amazing effects like a viewController in the Spotify app.
MIT License
1.02k stars 106 forks source link

App crashing on memory warnings #11

Closed SolomonBier closed 9 years ago

SolomonBier commented 9 years ago

I'm downloading pictures from Amazon S3 and setting the main image view via the setMainImage method. This works fine, but when scrolling the app crashes with a memory warning.

Is there a size constraint I should abide by ?

SolomonBier commented 9 years ago

Fixed the above with the following code. May be worth adding to the setMainImage method:

        // Resize Image
        CGSize size=CGSizeMake(self.mainImageView.frame.size.width,self.mainImageView.frame.size.height);
        UIGraphicsBeginImageContext(size);
        [tempImage drawInRect:CGRectMake(0, 0, size.width, size.height)];
        UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        //End Resize Image

        [self setMainImage:scaledImage];
matteogobbi commented 9 years ago

Hi, If you think to have fixed an issue, please submit a pull request.

Thank you.

SolomonBier commented 9 years ago

Submitted pull request. This edit may also address the other memory warning you previously closed.

Great work, love this VC!

Cheers