iphone - good examples of model-view-controller -
i'm new objective-c , iphone , thought getting hang of until, after many play apps, ran basic problem around mvcs, nibs , ib. there clear explained examples of how follow framework go to?
@interface test1viewcontroller : uiviewcontroller { iboutlet myview *myview; iboutlet mymodel *mymodel; }
both views , models linked in iboutlets instantiating model object either kills application or produces object not respond messages.
i unclear carry best out initialisations. on viewdidload in view controller. there standard way , simulator start in same way? should 1 use awakefromnib? make difference if use plain code or ib? , if have use ib, should include model object?
the mvc idea make sense me here because have potentially several views , view controllers feeding - , sharing - 1 common central data model. references or advance on newbie problem more welcome!
ib makes functionality invisible. don't , don't use ib more, preferring have in code. when @ code see going on - navigation controllers, formatters etc. - without switching on ib. maybe xcode4 make better integrated ib won't go back. lots of people ib try both methods , see best.
iboutlet/ibaction mean nothing compiler let ib recognise ivars can send messages or write elements in xib. use of here bit simplistic unless have model communicates 1 way xib. more have range of controls in xib linked view object, view communicating directly controller. controller communicates model. loosely speaking, model internal representation of data , logic, view see, controller glue between them.
the mvc line can fuzzy , have comfortable it. if have slider control value representing value in model can hard think of part of interface when persist value , use central part of model. stanford iphone class introduction of it. don't spend heap of time on because can difficult follow , there situations isn't best.
notes class - can find video on itunes follow along.
your use of viewdidload correct, that's chance perform initialization on views , objects. if using ib not have there because can set properties in xib. if not using ib use lot more.
Comments
Post a Comment