Contents

조회 수 1064 댓글 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"]];
}



?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
105 System/OS [linux] iptables 명령어 매뉴얼(options) hooni 2003.04.23 11402
104 System/OS [linux] 패킷의 소스 주소 바꾸기 hooni 2003.04.23 18845
103 System/OS [linux] 패킷 스니퍼링 hooni 2003.04.23 16371
102 System/OS [windows] 배치(bat)파일 제작 방법 hooni 2003.04.23 17054
101 System/OS [windows] 여러가지 활용 팁 hooni 2003.04.23 20024
100 System/OS [windows] 도스 사용 팁 hooni 2003.04.23 17890
99 System/OS [windows] 98/ME 속도 빠르게 튜닝(부팅,메모리,레지스터) hooni 2003.04.23 50523
98 System/OS [linux] ipfwadm를 이용한 패킷필터링(구버전) hooni 2003.04.23 13084
97 System/OS [linux] ipchains 사용예(패킷 필터링) hooni 2003.04.23 14235
96 System/OS [linux] ipchains 옵션 hooni 2003.04.23 13687
95 System/OS [linux] Xwindow/Xmanager 사용 hooni 2003.04.23 13381
94 System/OS [linux] 최소한의 커널 설정(커널설치 전체과정) hooni 2003.04.23 17466
Board Pagination Prev 1 ... 85 86 87 88 89 90 91 92 93 94 ... 98 Next
/ 98