ios - Custom UIView Subclass's drawRect not being called inside UITableViewCell -
background: have subclass of uitableviewcell layout defined prototype cell in storyboard. 1 of cell's iboutlets subclass of uiview made called borderedprofileimageview. class's drawrect: function overridden follows:
- (void)drawrect:(cgrect)rect { cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsetstrokecolorwithcolor(context, [[uicolor bluecolor] cgcolor]); cgcontextsetlinewidth(context, 1.f); cgfloat halfwidth = self.bounds.size.width/2; nsinteger radius = sqrt(pow(halfwidth, 2) + pow(halfwidth, 2)) - 8.5; cgcontextaddarc(context,self.bounds.size.width/2,self.bounds.size.height/2,radius,0,2*3.1415926535898,1); cgcontextstrokepath(context); } this adds bluish ring uiview.
problem: bluish ring never appears, , borderdprofileimageview's drawrect: function never gets called. cell still draws, uiimageview within borderdprofileimageview gets drawn. phone call setneedsdisplay on borderedprofileimageview when setting cell.
why drawrect: not getting called?
i figured out.
the object in ib set borderedprofileimageview uiimageview. changing object uiview , re-linking has resulted in desired behavior.
ios objective-c uitableview drawrect
No comments:
Post a Comment