// // AppDelegate.m // nexacro14App // // Created by 김재환 on 2016. 11. 24.. // Copyright © 2016년 com.tobesoft. All rights reserved. // #import "AppDelegate.h" @implementation AppViewController // 자동 회전 지원 여부 (YES/NO) - (BOOL)shouldAutorotate { return YES; } // 회전방향 지원 유무 리턴 (리턴값은 회전 방향의 비트값이 설정된 플러그) - (UIInterfaceOrientationMask)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAll; } @end @implementation AppDelegate - (NexacroMainViewController*)initializeMainViewController { NSString *bootstrapUrl = @"http://172.10.12.59:8080/nexacro17/TopsIssueLoader/_ios_/start_ios.json"; [[NexacroResourceManager sharedResourceManager] setBootstrapURL:bootstrapUrl isDirect:NO]; // WKWebView에서 발생하는 delegate이벤트가 필요없는 경우의 초기화 방법 AppViewController* controller = [[AppViewController alloc] initWithFullScreen:NO]; // WKWebView 에서 발생하는 delegate 이벤트를 받아야 할 경우의 초기화 방법 // WebViewDelegate* webviewDelegate = [[WebViewDelegate alloc] init]; // AppViewController* controller = [[AppViewController alloc] initWithFullScreen:NO // withWebviewDelegate:webviewDelegate]; return controller; } @end // WKWebView에서 발생하는 delegate이벤트를 받기위해 AppViewController 초기화때 전달하는 구현체 @implementation WebViewDelegate #pragma mark - WKWebView - WKScriptMessageHandler - (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message { [super userContentController:userContentController didReceiveScriptMessage:message]; } #pragma mark - WKWebView - WKNavigationDelegate - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(nonnull WKNavigationAction *)navigationAction decisionHandler:(nonnull void (^)(WKNavigationActionPolicy))decisionHandler { [super webView:webView decidePolicyForNavigationAction:navigationAction decisionHandler:decisionHandler]; } - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation { [super webView:webView didCommitNavigation:navigation]; } - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation { [super webView:webView didFinishNavigation:navigation]; } - (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error { [super webView:webView didFailNavigation:navigation withError:error]; } #pragma mark - WKWebView - WKUIDelegate - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler { [super webView:webView runJavaScriptAlertPanelWithMessage:message initiatedByFrame:frame completionHandler:completionHandler]; } - (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler { [super webView:webView runJavaScriptConfirmPanelWithMessage:message initiatedByFrame:frame completionHandler:completionHandler]; } - (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(nullable NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * __nullable result))completionHandler { [super webView:webView runJavaScriptTextInputPanelWithPrompt:prompt defaultText:defaultText initiatedByFrame:frame completionHandler:completionHandler]; } @end