Sequence of execution when loading xib?

余生长醉 提交于 2019-12-24 07:23:03

问题


I have been programming on iOS for almost six months now, using xibs left and right, but i am still unaware how loading process works...

What i mean, i have view controller and push button to open new modal view controller. From that point onwards how are things done. Is init method first called, then xib created, outlets connected and then nib loaded?

Is there any good article or book that explains this in details?


回答1:


Give this article a look: The View Controller Life Cycle




回答2:


this maybe not answer your question the way like you want, but i recommend you to find it out yourself.

How? see the text above.

  • use XLog() in case of NSLog()
  • paste the code above in your prefix.pch file
  • put in every method you want an XLog() statement and see, which methods are called firstly.

XLog() is a better way of NSLog(). In console you can see the Line numbers and the methodnames where the log is called. this should help you out to understand the way of loading nibs.


 #define DEBUG 1  

 //#define RELEASE 1

#ifdef DEBUG 

// Debug definitions 
#define DEBUG_MODE 
#define XLog(fmt, ...) NSLog(@"%s line:%d " fmt, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) 

#else 

#ifndef RELEASE 
#error DEBUG or RELEASE need to be #defined 
#endif 

// Release definitions 
#define RELEASE_MODE 
#define XLog(...) 

#endif


来源:https://stackoverflow.com/questions/12194509/sequence-of-execution-when-loading-xib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!