发现我的程序在内存检测中存在内存泄漏问题,代码如下
- (CALayer *)layerWithFrame:(CGRect)aFrame
contentGravity:(NSString *)aContentGravity
cornerRadius:(float)aRadius
doubleSided:(BOOL)aValue
{
CALayer *layer = [CALayer layer];
*****layer.frame = aFrame;*****
if (aContentGravity) {
layer.contentsGravity = aContentGravity;
}
layer.cornerRadius = aRadius;
layer.masksToBounds = YES;
layer.doubleSided = NO;
layer.contentsGravity = kCAGravityBottom;
return layer;
}
星号是我的程序内存位置,这是使用up代码:</p>
CALayer *testLayer = [self layerWithFrame: layerRect contentGravity:kCAGravityTop cornerRadius:sublayerCornerRadius doubleSided:NO];