Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should care about them! I currently track down such leaks. There are several possibilities, why they may occure:</p> <p><strong>1) Designing a UIView in the Interface Builder and initialize this view in a UIViewController (for animations and hiding/showing issues):</strong></p> <p>You may have defined some IBOutlets (in your .h file), which you might have connected in the Interface Builder to the File's Owner. This IBOutlets should (as far as i know) always be designed as a property (please feel free to correct me, if i'm wrong) and in the dealloc method, don't forget to "nil" it. </p> <p>e.g: In the viewcontroller header File (i named it MyViewController.h)</p> <blockquote> <p>@interface MyViewController : UIViewController {</p> <p>IBOutlet UIWebView* webView;</p> <p>}</p> <p>@property (nonatomic, retain) IBOutlet UIWebView* webView;</p> <p>@end</p> </blockquote> <p>And in the viewController's .m file:</p> <blockquote> <p>@implementation</p> <p>@synthesize webView;</p> <ul> <li>(void) dealloc {</li> </ul> <p>self.webView = nil; //never forget this, otherwhise it will leak</p> <p>[super dealloc]; </p> <p>}</p> <p>@end </p> </blockquote> <p><strong>2) Designing a UIView in the Interface Builder and subclass this View:</strong></p> <p>With subclassing i mean, that you can create a subclassed UIView Class and in the Interface Builder you set the class identifier to for example MyView</p> <p>e.g: </p> <blockquote> <p>@interface MyView : UIView {</p> <p>IBOutlet UIWebView* webView;</p> <p>}</p> <p>@property (nonatomic, retain) IBOutlet UIWebView* webView;</p> <p>@end</p> </blockquote> <p>Same as 1) (IBOutlets shoud be set nil on deallocation)</p> <p><strong>3) Adding a UIView as subview:</strong></p> <p>Never forget to remove this view.</p> <p>e.g: (in my MyViewController, i want to add a subview)</p> <blockquote> <ul> <li>(void) viewDidLoad {</li> </ul> <p>UIView *aSubView = [[UIView alloc] initWithFrame:CGRectMake(0,0, 90, 90)];</p> <p>aSubView.tag = 123;</p> <p>aSubView.backgroundColor = [UIColor blueColor];</p> <p>[self.view addSubView:aSubView];</p> <p>[aSubView release];</p> <p>}</p> </blockquote> <p>And:</p> <blockquote> <ul> <li>(void) viewDidUnload {</li> </ul> <p>[[self.view viewWithTag:123] removeFromSuperview]; //remove only aSubView</p> <p>for (UIView *subview in [self.view subwiews]) { //or remove any subviews</p> <p>[subview removeFromSuperview];</p> <p>}</p> <p>}</p> </blockquote> <p>Hope it helps!</p> <p>Br Nic</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