I found a somewhat related question at iPhone - dealloc - Release vs. nil, but it didn't answer my question.
I created a button, a UIScrollview
, and a label inside of it in the storyboard. When I Ctrl-dragged the objects to ViewController.h they created this:
@interface ViewController : UIViewController{
__weak IBOutlet UIScrollView *scroller;
}
@property (weak, nonatomic) IBOutlet UIButton *goButton;
@property (weak, nonatomic) IBOutlet UILabel *label;
@property (weak, nonatomic) IBOutlet UIScrollView *scroller;
- (IBAction)pressGo:(id)sender;
@end
And at the top of ViewController.m I have:
@implementation ViewController
@synthesize goButton;
@synthesize label;
@synthesize scroller;
And in viewDidUnload
it created:
[self setGoButton:nil];
[self setScroller:nil];
[self setLabel:nil];
scroller = nil;
[super viewDidUnload];
All created automatically. I've seen many references to dealloc
and release
.
Will this code, the premade stuff, prevent memory leaks? Or must I add dealloc
?
I apologize for any errors I have made... I'm new to this.