iphone - Can I use UIBezierPath to draw a shadow image around a UITableView section? -


i have shadow image draw around outer edge of grouped uitableview section. image:

enter image description here

i can uibezierpath represents rect want draw around, can't figure out how repeat image along route of rect. far fills rect image:

uiimage *patternimg = [uiimage imagenamed:@"cellshadow"]; uicolor *fill = [uicolor colorwithpatternimage:patternimg]; [fill setfill]; cgrect asectrect = [self rectforsection:0]; uibezierpath *asectpath = [self createroundedpath:asectrect]; [asectpath fill]; 

is possible? need do?

unfortunately, there's no way have uibezierpath use image "brush" you'd want. can have coregraphics draw shadow you:

cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsetshadow(context, cgsizezero, myshadowradius); // draw shape here 

now if draw 1 shape shadow. if draw more shapes, each own shadow might not want. solution called transparency layer, not related calayers or kind of "grouping" in coregraphics:

cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsetshadow(context, cgsizezero, myshadowradius); cgcontextbegintransparencylayer(context, null); // draw shapes here. cgcontextendtransparencylayer(context); 

between cgcontextbegintransparencylayer , cgcontextendtransparencylayer calls shadow disabled. after cgcontextendtransparencylayer call, shadow applied has been drawn between begin , end if 1 shape.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -