Reputation: 29
I'm new in IOS software development. I'm working on a new application with ARC. I'm Using Web services have added modules such as news and picture gallery.
I'm using picture slide in main activity with timer. But I'm getting memory warnings, and application finishes. I changed the resolution of the images which cames from web service. But the problem still continues. In practice, I use high quality designs. Viewer for iPhone 640 * 960 sizedesign I used in the photos. May be caused the design?
Upvotes: 0
Views: 851
Reputation: 1028
Yes it could be due to the large images that you are showing i think in UIScrollView or UICollectionView or could be in UITableView whatever you are using The memory warning is due to larger images.
- (UIImage *)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize {
UIGraphicsBeginImageContext(newSize);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
You can use the above code to change the size of Images. like
[imageView setImage:[self imageWithImage:@"Image" scaledToSize:CGSizeMake(100, 100)];
Or if you want you can rectify the code to use url of the image, these images will not produce memory warning.
Upvotes: 1