ios - EXC_BAD_ACCESS on setMask -


i'm trying apply mask both base layer , background layer, solutions below blows when setting mask on either layer. please let me know i'm doing wrong?

self.backlayer = [[calayer alloc] init]; [self.backlayer setbounds:[self bounds]]; [self.backlayer setposition:cgpointmake([self bounds].size.width/2, [self bounds].size.height/2)]; self.backlayer.opacity = 0.3f; [[self layer] insertsublayer:self.backlayer atindex:0];  [[self layer] setmaskstobounds:yes]; [[self layer] setborderwidth:0.0f];  uibezierpath* path = [uibezierpath bezierpathwithovalinrect:[self bounds]]; self.backlayer2 = [cashapelayer layer]; self.backlayer2.path = path.cgpath; self.layer.mask = self.backlayer2; self.backlayer.mask = self.backlayer2; cgpathrelease(path.cgpath); 

seems code posted perfect. there no problem code. exc_bad_access occur if perform action on deallocated object. please make sure self object/view not deallocated arc. check place declared view still alive in stack/memory. dont forget check property declaration parameters (strong/weak/noatomic) backlayer property.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -