ios - Shadow Issue for UITableViewCell -
i have custom uitableviewcell
, wrote shadow code in layoutsubviews
method:
-(void)layoutsubviews { [super layoutsubviews]; self.layer.shadowcolor = [uicolor blackcolor].cgcolor; self.layer.shadowoffset = cgsizemake(0, 4.0); self.layer.shadowradius = 4.0; self.layer.shadowopacity = 1.0; }
but when run it, instead of having shadow on edge, subviews
on cell got shadows, screen shot below, not expecting.
i tried self.contentview.layer
there wasn't shadows @ all.
so do have shadows on bottom edge of cell usual? don't want shadow subviews.
update:
i added subviews on cell [cell addsubview:xxx];
directly, not on contentview
of cell.
try one
instead of setting shadow in layoutsubview set in cellforrowatindexpath
cell.layer.shadowcolor = [uicolor blackcolor].cgcolor; cell.layer.shadowoffset = cgsizemake(0, 4.0); cell.layer.shadowradius = 4.0; cell.layer.shadowopacity = 1.0;
Comments
Post a Comment