ios - Adding border to image in cell's imageView -


i'd add border tvc cell's image through imageview , imageview layer

i've got code works cell.layer itself, change cell.imageview.layer, code nothing @ all.

i'm using within tableview:cellforrowatindexpath , in xcode 4.6.3, ios 6.x

uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; cell.imageview.image = [uiimage imagenamed:@"myimage.png"];  calayer* layer; //layer = cell.layer; layer = cell.imageview.layer; [layer setmaskstobounds:yes]; [layer setcornerradius:10.0f]; [layer setborderwidth:10.0f]; 

this works if applied cell.layer, nothing @ cell's imageview.layer.

any ideas?

thanks.

edit: fyi, importing <quartzcore/quartzcore.h>.

edit: though works against cell fine, because cell has border color defined black. imageview not , therefore requires border color set so:

[cell.imageview.layer setbordercolor: [[uicolor whitecolor] cgcolor]];   [cell.imageview.layer setbordercolor: [[uicolor blackcolor] cgcolor]];   [cell.imageview.layer setbordercolor: [[uicolor colorwithred:.5f green:.6f blue:.3f alpha:.75f] cgcolor ]]; 

another option is, add

#import <quartzcore/quartzcore.h> 

framework , use

cell.imageview.layer.borderwidth = 1.0f; cell.imageview.layer.setmaskstobounds = yes; 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -