확인이 코드에서
func applicationDidEnterBackground(_ application: UIApplication) {
if let appDelegate = UIApplication.shared.delegate as? AppDelegate,
let controller = appDelegate.window?.rootViewController as? FirstViewController {
controller.refreshItems()
}
}
func applicationWillEnterForeground(_ application: UIApplication) {
if let appDelegate = UIApplication.shared.delegate as? AppDelegate,
let controller = appDelegate.window?.rootViewController as? FirstViewController {
controller.refreshItems()
}
}
(FirstViewController 다른 윈도우의 rootViewController가 null를 AppDelegate에에 FirstViewController 인스턴스을 체크 인 경우) 목표 - C
- (void)applicationDidEnterBackground:(UIApplication *)application {
AppDelegate *appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
FirstViewController *controller = (FirstViewController*)[[appDelegate window] rootViewController];
[controller refreshItems];
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
AppDelegate *appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
FirstViewController *controller = (FirstViewController*)[[appDelegate window] rootViewController];
[controller refreshItems];
}
Objective - C – kiran