0

i have WebView load html. after scale html

-(void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self setupContentScale];
    self.webView.hidden = NO;
    [self setLoadingIndicatorVisible:NO];
}

scale metods

- (void)setupContentScale
{
    CGFloat scaleFactor = self.webView.bounds.size.width / self.webView.scrollView.contentSize.width;
    if (scaleFactor != DEFAULT_WEBVIEW_SCALE_FACTOR) {
        scaleFactor -= 0.2f; // to be sure that page will be scaled to required size
        [self.webView setScalesPageToFit:NO];
        [self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.body.style.zoom = %f;", scaleFactor]];

    }

    [self updateFontSize];
    [self updateLineHeight];
    [self updateContentWidth];


}

but i have Show indicator while html scale or callback metod and

self.webView.hidden = NO;
[self setLoadingIndicatorVisible:NO];

how get callback?

1 Answer 1

1
NSString *StrParameter=@"Test Parameter"

NSString *Str= [NSString stringWithFormat:@"var c = '%@',StrParameter];

[myWebView stringByEvaluatingJavaScriptFromString:Str];

NSString *newStringFinal = [myWebView stringByEvaluatingJavaScriptFromString:@"function final(){ return c; } final();"];

 NSLog(@"RESULT STRING: %@",newStringFinal);

//  Here newStringFinal  has Callback value which have current value of Variable 'c' in javascript... 
Sign up to request clarification or add additional context in comments.

2 Comments

NSString *EncyStr= [NSString stringWithFormat:@"var c = Obj.tools.encrypt('%@', Obj.tools.decrypt('%@', '%@'));",[[base64_input_value_Temp componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]] componentsJoinedByString:@""],[[base64_user_key_Temp componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]] componentsJoinedByString:@""],userPassword]; That will Work .. you can add more as you want
ok. check = if(newStringFinal){self.webView.hidden = NO; [self setLoadingIndicatorVisible:NO]; }?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.