When to release pushedViewController [iPhone]


hi all.


in iphone app, having viewcontroller uitableview, whenever user select row, create instance of same class, push viewcontroller, time table loaded new pair of data

code:
    in [i]customviewcontroller [/i]class if user select row in [i]mycustomtableview[/i] , following...    // file: customviewcontroller.m       if( isnextviewistableview)  {    customviewcontroller *customviewobj = [[customviewcontroller alloc]init];    customviewobj.itemarraytoreloadtable = ............   //assign array    [[self navigationcontroller]pushviewcontroller: customviewobj animated:yes];    [customviewobj relelase];  }    // end of hierarchy view, navigation reached leaf node  else if( isnextviewisproductview)    {     productview *productviewobj = [[productview alloc]init];     productview.textforlabel = ......//assign string     prodyuctview.textfornextlabel = ....... //assign string     [[self navigationcontroller]pushviewcontroller: productviewobj animated:yes];    [productviewobj relelase];    }    
if giving this, if click button anytime, calling release of dealloc of viewcontroller.

approach fine?

didnt find such approach in sample codes..
 

if these views accessed, recommended technique initialize them once , reuse same instance. in case release when parent view dealloc'ed. of apple sample apps have more 1 view utilize technique.
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Upgrade Eligibility?

need help with itunes 7.7

How to change Apple IDs on iPhones