iphone - UITableViewCell doesn't pickup UITableViewCellSelectionStyleBlue when adding CAGradientLayer sublayer -


i have uitableviewcell i've added gradient using cagradientlayer. works fine, table cell doesn't turn blue when selected, after setting it's selectionstyle uitableviewcellselectionstyleblue. if don't add gradient layer, works fine.

is there way make these items work together?

here's code inside of cellforrowatindexpath:

    //cell gradient             cagradientlayer *gradient = [cagradientlayer layer];     gradient.frame = cgrectmake(10, 0, 300, 50);     gradient.colors = [nsarray arraywithobjects:                        (id)[[uicolor colorwithred:255/255.0 green:255/255.0 blue:255/255.0 alpha:1] cgcolor],                        (id)[[uicolor colorwithred:255/255.0 green:255/255.0 blue:255/255.0 alpha:1] cgcolor],                        (id)[[uicolor colorwithred:245/255.0 green:245/255.0 blue:245/255.0 alpha:1] cgcolor],                        (id)[[uicolor colorwithred:247/255.0 green:247/255.0 blue:247/255.0 alpha:1] cgcolor],                        nil];     gradient.locations = [nsarray arraywithobjects:                           (id)[nsnumber numberwithfloat:0.00],                           (id)[nsnumber numberwithfloat:0.50],                           (id)[nsnumber numberwithfloat:0.51],                           (id)[nsnumber numberwithfloat:1.0],                                                                                                                     nil];     [cell.layer insertsublayer:gradient atindex:0];       //bring rounded corners creating masklayer      uibezierpath *maskpath = [uibezierpath bezierpathwithroundedrect:gradient.bounds byroundingcorners:uirectcornerbottomright|uirectcornerbottomleft cornerradii:cgsizemake(8, 8)];     cashapelayer *masklayer = [cashapelayer layer];     masklayer.frame = gradient.bounds;     masklayer.path = maskpath.cgpath;     gradient.mask = masklayer;      //add cell shadow     cell.layer.shadowcolor = [[uicolor blackcolor] cgcolor];     cell.layer.shadowradius = 3;     cell.layer.shadowopacity = 0.5;     cell.layer.shadowoffset = cgsizemake(0, 0);      cell.selectionstyle = uitableviewcellselectionstyleblue;       

it looks might putting gradient on view changes when selected- uitableviewcellselectionstyleblue view may appearing, cannot see (a way test out have gradient cover part of cell- if other part changes color when selected, issue).

if issue, own custom drawing cell when selected subclassing uitableviewcell, or have gradient disappear whenever cell selected (and reappear when cell deselected).


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -