最近做一个新闻客户端的项目,被webview字体设置大小纠结了好久,查了网上的一点资料,也请教了别人,最后找到了一种解决的方法,也不知道以前的大牛是怎么解决的,我把我的方法拿出来,和大家分享一下
在设置字体的cell里定义的segmentedControl的方法
-(void)segmentedControl:(UISegmentedControl *)seg{self.MutableDic=[[NSMutableDictionary alloc] init];//获取应用程序沙盒的Library目录NSString *homePath=NSHomeDirectory();NSString *document=[homePath stringByAppendingPathComponent:@"Library"];//得到完整的文件名NSString *plistPath = [document stringByAppendingPathComponent:@"setFont.plist"] ;NSLog(@"plistPath:%@",plistPath);NSInteger Index = seg.selectedSegmentIndex;NSLog(@"Index %d", Index);if (Index==0) {NSLog(@"小");//这是改变字体大小最主要的语句,而且格式不能改变//我把它当做字符串封装到字典里,然后就可以拿来操作了NSString * str = @"document.getElementsByTagName(ody)[0].style.webkitTextSiz