Contents

조회 수 971 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

JS 파일을 프로젝트로 추가하고 UIWebView 딜리게이트를 처리하는 내용

- (void)webViewDidStartLoad:(UIWebView *)webView{
    ...
    // JS파일들을 동적으로 추가하는 내용의 함수 호출
    [self injectJSCodes];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    ....

    // JS 함수가 잘 로드되고 실행 되는지 확인
    NSString *jsString1 = @"picomax.alert('2100411931200932');";
    [_webView stringByEvaluatingJavaScriptFromString:jsString1];
    
    NSString *jsString2 = @"OcbiOSJS.showBarcodeScanPopup('2100411931200932');";
    [_webView stringByEvaluatingJavaScriptFromString:jsString2];
}

- (void)injectJSWithPath:(NSString *)path
{
    //현재 프로젝트의 리소스 파일의 경로 얻기.
    //NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
    //NSString *path = [[NSBundle mainBundle] pathForResource:@"OcbiOSJS" ofType:@"js"];
    NSLog(@"js path : %@", path);
    NSString *jsString = [[NSString alloc] initWithContentsOfFile:path
        encoding:NSUTF8StringEncoding error:nil];

    [_webView stringByEvaluatingJavaScriptFromString:jsString];
}

- (void)injectJSCodes
{
    [self injectJSWithPath:[[NSBundle mainBundle]
        pathForResource:@"OcbiOSJS" ofType:@"js"]];

    [self injectJSWithPath:[[NSBundle mainBundle]
        pathForResource:@"OcbiOSTitleViewJS" ofType:@"js"]];
}



?

  1. 이어서 작업할 내용~

  2. [c#] 전자금융보안론 발표/설치 자료(툴바 소스코드)

  3. [ios] 스터디 자료 (from 종길M)

  4. [js] 2048 예쁘게 만들고 있는거.. ㅋㄷ

  5. [ios] 패스(path) 앱 메뉴 스타일

  6. 아이 훌레시 작업중 ㅋㅋ

  7. [ios] IB 없이 개발하기 (html)

  8. [ios] 최신 UI 모음.. (나중에 정리할 것)

  9. [iphone] PerfectlyClear 보정솔루션 최신..

  10. 사이버보안실무 수업 메모

  11. DDay Memo 1.9.4 소스코드

  12. [ios] APNS 샘플 코드..

Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 71 Next
/ 71