我用我的自定义方法初始化我的自定义视图:
1)在我的视图控制器中,我正在调用自定义视图并将这个数组传递给我的 UIView 类型的自定义类
NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"CustomViewiPhoneLayout" owner:self options:nil];
customViewObject = [[CustomView alloc] initWithArray:array];
[ParentLayout addSubview:customViewObject];
2) 自定义视图。
-(id)initWithArray:(NSArray*)array {
self = [array objectAtIndex:0]; // passing view as self; here it shows leak.
if(self) {}
return self;
}
它给了我可能的泄漏命名Returning 'self' while it is not set to the result of '[(super or self) init...]'