码迷,mamicode.com
首页 > Web开发 > 详细

上火啊,替换字符串,HTML,

时间:2015-08-31 18:55:38      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

-(void)webViewDidFinishLoad:(UIWebView *)webView

{

    JSContext *jsContext = [webView valueForKeyPath: @"documentView.webView.mainFrame.javaScriptContext"];

    jsContext[@"ocObj"] = self;

    //设置高度

    JSValue *jHeight  = [jsContext evaluateScript:@"document.body.scrollHeight"];

    self.mWebView.scrollView.contentSize = CGSizeMake(screenW, [jHeight toDouble]);

 

    JSValue *kContent = [jsContext evaluateScript:@"document.getElementById(‘guligei‘).innerHTML"];

    NSString *kName = [kContent toString];

    NSString *replaced = [kName stringByReplacingOccurrencesOfString:@"${studentName}" withString:@"战歌"];

    NSString *jsString = [NSString stringWithFormat:@"document.getElementById(‘stuName‘).innerHTML=‘%@‘",replaced];

    [jsContext evaluateScript:jsString];

}

 

 

                    returnStr =[returnStr stringByReplacingOccurrencesOfString:@"${studentName}" withString:SharedAppDelegate.userInfo.name];

上火啊,替换字符串,HTML,

标签:

原文地址:http://www.cnblogs.com/guligei/p/4773556.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!