Views 947 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

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. [ios] @property의 속성 (strong, weak, copy) 사용 경우

  2. [ios] TextField 특정 문자만 사용하도록 하기

  3. [ios] XCode에서 Provisioning Profile 여러개 중복될 때

  4. 알고리즘 성능 분석 기준

  5. 알고리즘 성능분석

  6. [ios] iOS에서 디바이스 종류 알아오기

  7. [ios] 아이폰 GPS 사용하기

  8. [ios] 언어, 지역, 국가 설정 가져오기

  9. [ios] URL 파라미터 파싱~

  10. [ios] 앱 딜리게이트 얻어오기. (AppDelegate)

  11. [ios] 앱딜리게이트 라이프사이클 (AppDelegate Lifecycle)

  12. [ios] 애플 앱스토어 IDFA 리뷰 정책 변경 안내

  13. [ios] NSString URL Encode/Decode (인코딩/디코딩)

  14. [ios] 커스텀 폰트 사용하기 (Custom Fonts)

  15. [ios] iOS 의 인앱구매 소개

  16. [js] Array.splice() 설명

Board Pagination Prev 1 ... 10 11 12 13 14 ... 53 Next
/ 53