view - iOS equivalent to Android registerActivityLifecycleCallbacks -
i developed android app used application.registeractivitylifecyclecallbacks (http://developer.android.com/reference/android/app/application.html) know when each activity started , stopped , record analytics purposes. developing ios version , cannot find equivalent method monitor uiviewcontrollers or uiview displayed app.
anybody has idea ? beginner on ios may not taking right approach, feel free suggest other ideas.
edit
after first answer felt should more precise. developing sdk other developers include in apps want impact of sdk on code small possible.
i first thought doing baseactivity
/baseuiviewcontroller
developers have extend in activity
/uiviewcontroller
felt heavy , since both language don't allow multiple inheritance impact code. why registeractivitylifecyclecallbacks
method great in android because have give me application
or activity
object.
is there solution ios or have create basecontroller ?
thank in advance.
i've not run specific application.registeractivitylifecyclecallbacks in ios, implement own using methods exist within appdelegate , each class.
from appdelegate, provided methods determine state of overall application such determining when application finished loading, when enters background, , forth. details on these states can found in uiapplicationdelegate protocol reference page.
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // override point customization after application launch. nslog("application did finish launching options: %@", launchoptions); return yes; }
for each view controller, can add implementation individual view controller lifecycle methods within each file. methods such viewdidload
, viewwillappear
, viewdidappear
, , viewdidlayoutsubviews
available.
- (void)viewdidload { [super viewdidload]; nslog(@"view %@ did load", self); }
Comments
Post a Comment