I am new to Objective-C and iPhone and thought I was getting this freeze until, after many applications for the game, I came across a really basic problem in MVC, NIB, and IB. Are there really clear-cut, explained examples of how to follow this framework that I could return to?
@interface test1ViewController : UIViewController { IBOutlet myView *myview; IBOutlet myModel *mymodel; }
Both views and models are linked in IBOutlets, but instantiating a model object either kills the application or creates an object that does not respond to any messages.
I also do not understand where the initialization is best. I am currently doing this on viewDidLoad in a view controller. Is there a standard way to do this, and is the sim always running in the same way? Should I use awakeFromNib? Does it matter if I use simple code or IB? And if I use IB, should it include a model object?
The MVC idea would make sense to me here because I have potentially several views and view controllers that all return - and share - one common central data model. Any links or progress on this newbie issue will be more than welcome!
IB . , IB, . , , , - , .. - IB. , Xcode4 IB, , , . IB, , .
IBOutlet/IBAction , IB , , xib. , , xib. , , - xib, , . . , - , - , , - .
MVC , . , , , . iPhone Stanford. , , , .
- iTunes, .
viewDidLoad , . IB, , , , xib. IB, .
"" MVC. iOS , . ( "View Controller" )
, . myModel? IBOutlets.
nibs - " ". , "", . , spring , , , . " " "", IB. . , nib "" . , , . awakeFromNib, , , , , , - , .
viewDidLoad , . , ! ( , viewDidLoad , ... .) , viewDidLoad, .
" " Singleton. . KVO ( ) .
- .
IB is usually used more to associate views and controllers with the application transferring the model (s).
However, you should be able to create an IB instance of your model and assign it to IBOutlet. Was your OK model just created without calling the classic init method? Did he implement NSCoding correctly?
Source: https://habr.com/ru/post/1777780/More articles:ListView content scrambled in scroll - androidЗахват исключения из исходного кода в Javascript? - javascriptHow to ensure that the MAPI client receives focus when it starts? - winapiКак отобразить значок в элементе меню? - pythonGetting object executing java.security.PrivilegedAction at runtime - javaHow to make a chrome plugin - google-chromeWhy should a return type be specified for a function when it is called in C? - cF # - how can I index a collection (in particular PropertyCollection) - f #call e.stopImmediatePropagation () from onclick attribute - javascriptReal-time search using AsyncTask? - androidAll Articles