uitableview - iphone: Scale the image in table cell -
i using uitableviewcellstylesubtitle. trying add together thumbnails table cells. uiviewcontentmodescaleaspectfit not seem work reasons unknown. have seen lot of answers in stack overflow similar kind of questions. if crop image using drawinrect works, this
[thumbnail drawinrect:thumbnailrect]; uiimage *scaledimage = uigraphicsgetimagefromcurrentimagecontext(); but trying accomplish should not need me this. trying scale image , not crop it. setting content mode "uiviewcontentmodescaleaspectfit" imageview of default cell should work.. not.
cell.imageview.contentmode = uiviewcontentmodescaleaspectfit; complete logic setting thumbnails.. fpath path image
uiimage *thumbnail = [uiimage imagewithcontentsoffile:fpath]; [cell.imageview setimage:thumbnail]; cell.imageview.contentmode = uiviewcontentmodescaleaspectfit; cell.imageview.clipstobounds = yes;
i found out drawinrect stretches original image if size lower or croppes if bigger.
this article help prepare thumbnail of image http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/
it has several useful uiimage classes extentions: * uiimage+resize * uiimage+alpha * uiimage+roundedcorner
example usage:
uiimage *imagethumb = [yourimage thumbnailimage:70 transparentborder:0 cornerradius:10 interpolationquality:kcginterpolationhigh];
and can utilize drawinrect method. if image not rectangle - image crop bigger side , take middle of image
hope reply guide you.
iphone uitableview size image-scaling
No comments:
Post a Comment