How should I manage the memory allocated for the UIView returned from viewForHeaderInSection?

I'm about to implement the UITableViewDelegate::viewForHeaderInSection method, where I plan to allocate and init a new UIView object and return it. I'm new to iOS development, but I'm trying to adhere to the general rule of thumb that if I create it, I'm responsible for deleting it, but I can figure out how the UIView object is handled after I pass it on to the UITableView. Should I autorelease the UIView object? Should I store it in an instance var and release it in my dealloc?

Thanks for your help!

Answers


I would autorelease the UIView.

I would only store it in an instance variable if you need an reference to it later.


Need Your Help

How to make my spider's leg move in XNA

xna 3d blender maya 3d-modelling

I've done a 3D spider model in Blender, and currently I can export it as a .x(direct X) file and import this .x file into XNA gamestudio and make it shown there as a static model.

Grails: selecting Children of Parent of Child with given id (subquery) with a Where Query

hibernate grails subquery gorm

Using grails 2.1.0 and default H2 database. I've got the following domains: