0

I have a simple "About" view that I've made in a storyboard. Basically all it has is a UITextView. It's controller looks like this:

// AboutViewController.m

#import "AboutViewController.h"

@interface AboutViewController()

@end

@implementation AboutViewController

@end  

I want to add an outlet for the UITextView so I can add some rounded corners in code. When I Ctrl + drag from the storyboard up in between the @interface and @end and call the outlet aboutBlurb, my AboutViewController.m becomes the following:

// AboutViewController.m
#import "AboutViewController.h"

@interface AboutViewController()
@property (weak, nonatomic) IBOutlet UITextView *aboutBlurb;

@end

@implementation AboutViewController

- (void)viewDidUnload {
    [self setAboutBlurb:nil];
    [super viewDidUnload];
}
@end

My question is, why is XCode inserting the viewDidUnload method and niling my aboutBlurb property? I thought with ARC, niling properties in the viewDidUnload method was unnecessary. Furthermore, I thought Apple had deprecated the viewDidUnload method completely in iOS 6. Is there a rational reason for the viewDidUnload method being auto-generated, or can I safely remove it?

Bryce Thomas
  • 10,479
  • 26
  • 77
  • 126
  • 1
    that's because your Development Target is iOS5 or below, and in the versions previous to iOS6 the implementation of this method is recommended – tkanzakic May 07 '13 at 12:24
  • @tkanzakic am I right that under ARC the call to `[self setAboutBlurb:nil]` is superfluous though, or have I misunderstood how ARC works? – Bryce Thomas May 07 '13 at 12:51
  • that could depend in the IBOutlet declaration, but in your case that you declare it as `weak` I think it is not necessary, take look to this answer http://stackoverflow.com/a/12104705/1411844 – tkanzakic May 07 '13 at 13:13
  • @BryceThomas: if it was not superfluous in MRC then it is not superfluous in ARC – newacct May 07 '13 at 21:49

0 Answers0