axe
axe

Reputation: 27

Is a release needed on a ViewController

When loading the ZZZViewController as shown below

ZZZViewController *zzzvc = [[ZZZViewController alloc] initWithNibName:@"ZZZViewController" bundle:nil];
zzzvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:zzzvc animated:YES];

do I now do a [zzzvc release];

Thanks

Upvotes: 1

Views: 153

Answers (2)

Michaël
Michaël

Reputation: 6734

Yes because :

alloc => +1
presentModalViewController => +1
dismiss => -1

total : +1 not 0. => BAD

release => -1

total : 0 => OK

Upvotes: 0

MarkPowell
MarkPowell

Reputation: 16540

Yes, you alloc/init'd it. You are responsible for cleaning it up.

Upvotes: 5

Related Questions