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

如何改变UIWebView的字体大小呢?

时间:2015-05-05 21:24:35      阅读:112      评论:0      收藏:0      [点我收藏+]

标签:

@interface

NSUInteger textFontSize;



- (IBAction)changeTextFontSize:(id)sender

{

    switch ([sender tag]) {

        case 1: // A-

            textFontSize = (textFontSize > 50) ? textFontSize -5 : textFontSize;

            break;

        case 2: // A+

            textFontSize = (textFontSize < 160) ? textFontSize +5 : textFontSize;

            break;

    }



    NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName(‘body‘)[0].style.webkitTextSizeAdjust= ‘%d%%‘", 

                          textFontSize];

    [web stringByEvaluatingJavaScriptFromString:jsString];

}

如何改变UIWebView的字体大小呢?

标签:

原文地址:http://www.cnblogs.com/huangzs/p/4479894.html

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