calayer - iOS - Shadow won't resize correctly -



calayer - iOS - Shadow won't resize correctly -

i have tableview dynamic cell sizes, , having problem resizing shadow when cells beingness reused. solution works on ios8 not on ios7. shadows show correctly based on cell size first time shadow create, break after cells beingness reused.

@implementation static const cgfloat shadowwithinset = 2; static const cgfloat shadowheightoutset = 4; - (void)awakefromnib { calayer *layer = self.innerview.layer; layer.shadowoffset = cgsizemake(1, 1); layer.shadowradius = 3.0f; layer.shadowcolor = [[uicolor gray] cgcolor]; layer.shadowopacity = 0.8f; //layer.shouldrasterize = yes; //layer.rasterizationscale = [uiscreen mainscreen].scale; cgsize size = layer.bounds.size; layer.shadowpath = [uibezierpath bezierpathwithrect:cgrectmake(shadowwithinset, size.height-shadowheightoutset, size.width-(shadowwithinset*2), shadowheightoutset)].cgpath; } - (void)layoutsubviews { [super layoutsubviews]; cgsize size = self.innerview.bounds.size; layer.shadowpath = [uibezierpath bezierpathwithrect:cgrectmake(shadowwithinset, size.height-shadowheightoutset, size.width-(shadowwithinset*2), shadowheightoutset)].cgpath; } @end

after populating textfields in cellforrowatindexpath ended doing this:

[self setneedslayout]; [self layoutifneeded];

ios calayer shadow

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -