ios - viewDidLoad not called when initialising obj viewcontroller from Swift -
in swift code, trying instantiate objective-c view controller below, viewdidload method not being called.
let detailmessagevc = detailmessageviewcontroller(nibname:nil, bundle:nil) if instantiate same viewcontroller objective-c code called. there no xib view controller.
self.detailmvc = [[detailmessageviewcontroller alloc] init]; does know why happening? have same behaviour when calling swift rely on viewdidload perform various initialisation. xcode 6.3.2
as comment stated, there no link between initialisation of view controller , it's viewdidload callback.
you can have viewdidload called before init. because viewdidload called if viewcontroller loaded view.
check there : https://stackoverflow.com/a/4862772/1486230
although, wouldn't rely on viewdidload unless know display viewcontroller; using myvc.view.
just think initialising viewcontroller (which logic object) different creating view. performance reason, ios won't create graphic object if not needed. if difference between swift , objective-c, it's more because swift better on optimisation. behaviour normal.
Comments
Post a Comment