Skip to content

Commit ebc3c92

Browse files
author
Jakey
committed
修改webview标签字体
1 parent e6380ef commit ebc3c92

File tree

3 files changed

+129
-561
lines changed

3 files changed

+129
-561
lines changed

WebViewJS/ViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
- (IBAction)insertDivHtml:(id)sender;
2222
- (IBAction)submitTouched:(id)sender;
2323
- (IBAction)replaceImgSrc:(id)sender;
24+
- (IBAction)fontTouched:(id)sender;
2425
@end

WebViewJS/ViewController.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,10 @@ - (IBAction)replaceImgSrc:(id)sender {
9999
NSString *tempString2 = [NSString stringWithFormat:@"document.getElementsByTagName('img')[0].src ='%@';",@"light_advice.png"];
100100
[self.myWeb stringByEvaluatingJavaScriptFromString:tempString2];
101101
}
102+
//修改标签字体
103+
- (IBAction)fontTouched:(id)sender {
104+
NSString *tempString2 = [NSString stringWithFormat:@"document.getElementsByTagName('p')[0].style.fontSize='%@';",@"19px"];
105+
[self.myWeb stringByEvaluatingJavaScriptFromString:tempString2];
106+
107+
}
102108
@end

0 commit comments

Comments
 (0)