ios - CAShapeLayer rounding corners impacts performance -


i have uicollectionview (ipad) has jarry scrolling.each cell has white rectangle uiview (with rounded corners) has uiimageview in front of top 2 corners rounded. see link below how cell looks - i.stack.imgur.com/ptlig.png

here's code uicollectionviewcell

    uiview * bgview = [[uiview alloc] initwithframe:cgrectmake(5, 5, (self.contentview.frame.size.width - 10), (self.contentview.frame.size.width - 10)*image_ratio + 43.5)];     bgview.backgroundcolor = [uicolor clearcolor];     bgview.layer.cornerradius = 10;     bgview.layer.borderwidth = 0.5f;     bgview.layer.bordercolor = [uicolor colorwithred: 179/255.0 green:181/255.0 blue:184/255.0 alpha:1.0].cgcolor;     bgview.layer.backgroundcolor = [uicolor whitecolor].cgcolor;     bgview.layer.shouldrasterize = yes;     bgview.layer.rasterizationscale = [uiscreen mainscreen].scale;     [self.contentview addsubview:bgview];      self.parablepost = [[uiimageview alloc] initwithframe:cgrectmake(5, 5, (self.contentview.frame.size.width - 10), (self.contentview.frame.size.width-10)*image_ratio)];     uibezierpath *maskpath = [uibezierpath bezierpathwithroundedrect:self.parablepost.bounds byroundingcorners:(uirectcornertopleft | uirectcornertopright) cornerradii:cgsizemake(10.0, 10.0)];     cashapelayer *masklayer = [cashapelayer layer];     masklayer.frame = self.parablepost.bounds;     masklayer.path = maskpath.cgpath;     self.parablepost.layer.mask = masklayer;     [self.contentview addsubview:self.parablepost]; 

when line "self.parablepost.layer.mask = masklayer" commented, scrolling smooth. cashapelayer causing performance issues. tried rasterize , hand drawing instead of using uibezierpath not improve experience.

is there faster way round 2 corners of uiimageview?

edit:

i added static images simulate rounded corners on top 2 corners of uiimageview gave me same without scroll jitter. surprised cashapelayer performance drain.

masks expensive... (they might rendered in software). try think of way want. example, pre-render things image...


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -