ボタンを長押しすると、UIViewController(AddProduct) を含む UIPopover が開きます。ボタンを長押しすると、製品の追加には、ユーザーを ABCViewControl に戻すキャンセル ボタンが含まれます。 .この時点までは問題ありません。このようなもの..
-(void)openProductPopUp:(int)productId action:(BOOL)action{
AddProduct *addproduct = [[AddProduct alloc] initWithNibName:@"AddProductNew" bundle:[NSBundle mainBundle]];
[addproduct setProductId:productId];
[addproduct setIsAddingProduct:action];
UINavigationController *nav = [[UINavigationController alloc]
initWithRootViewController:addproduct];
[addproduct setDelegate:self];***//weak in add product***
[addproduct setDatabasePath:databasePath];
[addproduct setBackTracker:nil];
[addproduct setArrCategories:self.arrCategoryForPopUp];
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:nav];
popover.delegate = self;
[popover setPopoverContentSize:CGSizeMake(576 , 490) animated:NO];
[popover presentPopoverFromRect:CGRectMake(512, 430, 1, 1) inView:self.view permittedArrowDirections:0 animated:YES];
self.popOver=popover;
[addproduct setPopUp:popover];***//weak in add product***
addProduct = YES;
}
AddProduct には、別の uiviewcontroller(AddProductSeparateViewController) を開く編集ボタンが含まれています。それ (AddProduct) にはキャンセル ボタンも含まれています。キャンセル ボタンをクリックすると、ユーザーは ABCViewCintroller に戻ります。
**問題:** AddProduct はこのプロセスで解放されますが、AddProductSeparateViewController は、割り当てツールのライブ オブジェクトと dealloc ブレークポイントに従って解放されません。
AddProductSeparateViewController を開くための AddProduct のコードは次のとおりです。
-(IBAction)Edit:(id)sender {
[delegate openEditProductPage:self.productId action:NO];
}
このデリゲートは基本的に、AddProductSeparateViewController を開くように ABCViewController に通知します。
-(void)openEditProductPage:(int)productId action:(BOOL)action{
[self.popOver dismissPopoverAnimated:YES];
[self openAddEditProductSeparatePage:productId action:action];
}
-(void)openAddEditProductSeparatePage:(int)productId action:(BOOL)action{
[self.searchBar resignFirstResponder];
self.isSalesVuOrderScreenHidden = YES;
[self setControlVisibility:YES];
btnClockIn.hidden=YES;
btnLogout.hidden=YES;
[btnBack.titleLabel setHidden:NO];
self.viewController = [[AddProductSeparateViewController alloc] init];
[self.viewController setProductId:productId];
[self.viewController setSalesVuScreen:self];
[self.viewController setIsAddingProduct:action];
[self.viewController setDelegate:self];
[self.viewController setDatabasePath:databasePath];
[self.viewController setBackTracker:nil];
[self.viewController setArrCategories:self.arrCategoryForPopUp];
[self.viewController.view setFrame:CGRectMake(0,48,1024,self.view.frame.size.height-48)];
[self.view addSubview:self.viewController.view];
}
キャンセルする AddProductSeparateViewController のコードは次のとおりです。
-(IBAction)cancel:(id)sender {
[self.view removeFromSuperview];
}
このプロセスで AddProductSeparateViewController がリリースされないのはなぜですか。
ありがとう