Confused by memory issue with UIDatePicker
Confused by memory issue with UIDatePicker
- Subject: Confused by memory issue with UIDatePicker
- From: Daniel Wambold <email@hidden>
- Date: Sun, 16 Jun 2013 18:30:44 -0400
Dear List,
I am using manual retain count memory management (started long before ARC was available) for an iOS app. I have a UIDatePicker in an .xib file with its File's Owner set to a custom class, MyTimeDatePickerVC. The MyTimeDatePickerVC inherits from UIViewController, and has an IBOutlet attached to the UIDatePicker. The MyTimeDateVC instance is created in code, in response to a button tap:
MyTimeDatePickerVC *myTimeDatePickerVC = [[[MyTimeDatePickerVC alloc] initWithVoucherType:VoucherTimeTypeSurgery andInitialTimes:myInitialTimesDict] autorelease];
[self.navigationController pushViewController:myTimeDatePickerVC animated:YES];
The entire view is dismissed in response to a button tap in its view:
[self.navigationController popViewControllerAnimated:YES];
However, if I don't specifically release the UIDatePicker object in the view controller's dealloc, it leaks. If I include [myTimeDatePickerUIOutlet release] in dealloc, it doesn't leak and it works fine.
My question is: why should I be releasing this object at all? Or, should I explicitly be creating it somewhere, but I'm not, so the runtime is creating it for me as a courtesy (seems unlikely)? There's a UITableView in the same view (with a corresponding IBOutlet in the same ViewController header), but I don't create or release that explicitly. What have I missed? Do these pickers get treated differently for some reason? (Should I also be releasing the UITableView? The UIButtons?)
Thanks for any insight.
Best Regards,
Dan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden