Thursday, 15 January 2015

ios - UITableView and thumbnails -



ios - UITableView and thumbnails -

uitableview has uiimageview, images has same size. when starting scroll or selecting row, images can alter size. cannot understand why. or how create imageview of fixed size in table row?

use uigraphicsimagecontext table view cell image view :

uiimage *thumbnail = [uiimage imagenamed:[_imagearray objectatindex:indexpath.row]]; // setting thumbnail image cgsize itemsize = cgsizemake(60, 40);// sample image size uigraphicsbeginimagecontext(itemsize); cgrect imagerect = cgrectmake(0.0, 0.0, itemsize.width, itemsize.height); [thumbnail drawinrect:imagerect]; cell.imageview.contentmode = uiviewcontentmodescaleaspectfill; cell.imageview.image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();

ios objective-c uitableview

No comments:

Post a Comment