ios - How to reduce the memory size of the image saved in Document Directory? -
i have made iphone app in download images via ftp
& saved in document directory.
these images of high memory size (approx. 2-3 mb).
then display these images in uitableview
many rows & due these images allocation memory big & that's why app crashes.
so, need reduce memory size of these images.
how can this?
thanks,
make thumbnail of images before add them uitableview. in way size of images reduce drastically. use following code on uiimages picking document directory .
uiimage *originalimage = ...; cgsize destinationsize = ...; uigraphicsbeginimagecontext(destinationsize); [originalimage drawinrect:cgrectmake(0,0,destinationsize.width,destinationsize.height)]; uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
also have @ following links :-
http://www.icab.de/blog/2010/10/01/scaling-images-and-creating-thumbnails-from-uiviews/
Comments
Post a Comment