我发现我的程序在检测内存时有内存泄漏问题,代码如下
- (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;
}
Asterisk是我的程序内存位置,这是使用up代码:
CALayer *testLayer = [self layerWithFrame: layerRect contentGravity:kCAGravityTop cornerRadius:sublayerCornerRadius doubleSided:NO];