objective c - Leak when adding subview -


Text after "

Then the device tells me I have this method (specifically, there are three memory leaks that occur, line: [self .view addSubview: menuBar.view];

I can not see a leak and my mind is racking I am keeping the context of the menubar object and issuing it to me is more cunning than anyone It is also a coincidence that I do not have three menubar items in my XIB And I'm leaking three that

Here is the whole method:?

// Root Vocal Performance call to turn state (! MenuBarView) (IBAction) ShowToolbar { // if there exists a toolbar, add it to create and view {menuBarViewController * menu barr = [[MenuBarViewController alloc - screen

on the menu bar] initWithNibName: @ " MenuBarViewController "bundle: zero]; menuBar.book = self.selectedTitleDeck; menuBar.booksArray = self.allTitleDeck; self.menuBarView = menubar [self.view addSubview: menuBar.view]; [Menubar release]; } CGRect fr Ame = menuBarView.view.frame; [UIView startup permissions: zero reference: NULL]; If (self.toolBarIsDisplayed == no) {// toolbar frame shows .origin.y = 725; Self.toolBarIsDisplayed = Yes; } Else if (self.toolBarIsDisplayed == Yes) {// tool bar frame.origin.y = 788 hide; Self.toolBarIs display = no; } Self.menuBarView.view.frame = frame; [UIView commitAnimations]; } Postcode "itemprop =" text ">

addSubview: The view passed in (see) it retains in.

Once you say addSubView, you can continue to see that, like:

  MenuBarViewController * MenuBar = [[MenuBarViewController alloc] initWithNibName: @ "MenuBarViewController" bundle: zero ]; MenuBar.book = self.selectedTitleDeck; Menubar Bookshare = self All titles; Self.menuBarView = Menu Bar; [Self.view addSubview: menuBar.view]; [MenuBar.view release]; [Menubar release]; }  

Comments