我从网上的某个地方抽取这一样本。
我的档案包括:
@interface PopupWindowString : CCNode <UITextFieldDelegate> {
UIView *landscapeView;
UITextField *username;
}
和我手法中的档案有:
landscapeView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
CGAffineTransform tr = landscapeView.transform;
tr = CGAffineTransformRotate(tr, (M_PI * -2.0));
landscapeView.transform = tr;
landscapeView.center = [[CCDirector sharedDirector] openGLView].center;
username = [[UITextField alloc] initWithFrame:CGRectMake(160, 100, 160, 90)];
[username setTextAlignment:UITextAlignmentCenter];
[username setDelegate:self];
[username setPlaceholder:@"New name"];
[username setTextColor:[UIColor colorWithRed:255 green:255 blue:255 alpha:1.0]];
[landscapeView addSubview:username];
[[[CCDirector sharedDirector] openGLView] addSubview:landscapeView];
一切都是冷静的,但当我结束流行性交易时,没有人叫他。
看来,在《地貌观察法》颁布后,仍保留着“Count”:
[username release];
[username removeFromSuperview];
[landscapeView release];
[landscapeView removeFromSuperview];
我不知道与它做什么。 我没有别的地方,我只在这里使用地貌语。
我试图将《国际律师联合会意见》分门别类,试图从保留和释放到什么地方,并在此列出:
1. 会议开幕:
- Retain call from my PopupWindowString init method
- Retain from [CALayer layoutSublayers]
- Release from CALayerLayoutIfNeeded
填满:
- retain from [__NSArrayM addObject] in [UIView(Hierarchy) subviews]
- release from my code [the one I pasted previously]
- release from my code [remove from subview]
As you can see one release is missing. I think, when closing the popup, this first retain is caused by me touching the view. However it is never released.
任何人都知道如何独一无二。
Thanks, Krystian