UIViewController のビューとスクロールビューのボタンをサブビューとして追加しました...UIViewController のすべてのインスタンスを解放するにはどうすればよいですか...ここに添付画像があります
ビューでは、すべての uiview にさらにナビゲーションするためのボタンがあります....
ここで、uiview のボタンを解放してスクロールビューからボタンを削除したいと考えています。サブビューを追加する方法は次のとおりです。
if ((lastButtonNumber == 1) || ((lastButtonNumber%2) == 1)) {
btnLeft = 8;}
else if ((lastButtonNumber == 2) || ((lastButtonNumber%2) == 0)) {
btnLeft = 162;
}
CGRect frame1 = CGRectMake(btnLeft, btnTop, 150, 150);
CGRect frame2 = CGRectMake(btnLeft, btnTop, 150, 150);
UIButton *Button = [UIButton buttonWithType:UIButtonTypeCustom];
Button.frame = frame1;
Button.tag = myButtonTag;
[Button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
[Button setBackgroundColor:[UIColor clearColor]];
[Button setBackgroundImage:[UIImage imageNamed:@"WaitScreen.png"] forState:UIControlStateHighlighted];
[Button setBackgroundImage:[UIImage imageNamed:@"WaitScreen.png"] forState:UIControlStateSelected];
if(categoryType==1)
{
MultiChoiceThumbViewControllerobj = [[MultiChoiceThumbViewController alloc] initWithPageNumber:myButtonTag+1];
MultiChoiceThumbViewControllerobj.view.frame=frame2;
MultiChoiceThumbViewControllerobj.lblCounter.text=[NSString stringWithFormat:@"%d of %d",myButtonTag+1,flashCardsId.count];
MultiChoiceThumbViewControllerobj.lblQuestion.text=[flashCardText objectAtIndex:myButtonTag];
[myScrollView addSubview:MultiChoiceThumbViewControllerobj.view];
}
[myScrollView addSubview:Button];
}
このコードでは、スクロールビューのサブビュー数は= 96です。
サブビューを削除するために dealloc でこのメソッドを使用しましたが、UIvicontroller を解放していません
for(UIView *subview in [myScrollView subviews])
{
[subview removeFromSuperview];
NSLog(@"Subviews Count=%d",myScrollView.subviews.count);
}
どうすれば uiviewcontroller を解放できますか???