iphone - black background when overriding drawRect in UIScrollView -
so trying override drawrect in uiscrollview, gives me black background instead of background color i've specified uiscrollview. why this? if remove drawrect code fine:
- (void)drawrect:(cgrect)rect { [super drawrect:rect]; if (shoulddrawverticallineforprofile){ cgcontextref context = uigraphicsgetcurrentcontext(); cgcolorref separatorcolor = [uicolor colorwithred:47.0/255.0 green:47.0/255.0 blue:47.0/255.0 alpha:1.0].cgcolor; // add @ bottom cgpoint startpoint = cgpointmake(60, 0); cgpoint endpoint = cgpointmake(60, 10000); cgcontextsavegstate(context); cgcontextsetlinecap(context, kcglinecapsquare); cgcontextsetstrokecolorwithcolor(context, separatorcolor); cgcontextsetlinewidth(context, 5.0); cgcontextmovetopoint(context, startpoint.x + 0.5, startpoint.y + 0.5); cgcontextaddlinetopoint(context, endpoint.x + 0.5, endpoint.y + 0.5); cgcontextstrokepath(context); cgcontextrestoregstate(context); } }
i guess searching is:
myscrollviewinstance.opaque = no
after background of scroll view should not black anymore.
Comments
Post a Comment