Note that there are some explanatory texts on larger screens.

plurals
  1. POMemory management problem (release UIVIewCotroller)
    primarykey
    data
    text
    <p>I develop the game for iPad (composing image from puzzles). In my menu i choose level difficult (simple, medium or hard). After selecting the main playing field will be shown. Here's place, where i create the main playing field:</p> <pre><code>- (void)simpleDiffButtonClicked:(id)sender { UIButton *button = sender; if (simpleDiffButton == button) { UIView *mySuperView = self.view.superview; mainGame = [[MainGame alloc] initWithMode:1 andImage:nil]; //mainGame variable is declared in header file like: MainGame *mainGame; mainGame.view.frame = CGRectMake(0, 0, 1024, 768); [mySuperView addSubview: mainGame.view]; } </code></pre> <p>}</p> <p>After this playing field is appears (there are a lot of sublayers adding to self.view.layer) and i can interact with it. When i want to quit from it, i click button "back". (here i want to release my viewcontroller)</p> <pre><code>- (void)backToMenuButtonClicked:(id)sender { UIButton *button = sender; if (nextImageClick == YES) { return; } if (backToMenuButton == button) { self.view.layer.sublayers = nil; //here's an exception [self.view removeFromSuperview]; } } </code></pre> <p>After clicking "back" button everything is ok. And i can choose difficultly level again. A choose a level, and after it clicking "back" button again and at this place application crashes (EXC_BAD_ACCESS). As i understand "<strong>self.view.layer.sublayers = nil</strong>" causes the exception. Without it everything is ok. But memory is leaking. And after several minutes of playing app was crashes (memory warning 2). I cannot solve the problem for about a week. I don't understand what to do to release my viewcontroller (or i need to release all sublayers in controller?).</p> <p>Please, someone help me. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload