标签:失效 字体 ati dict 1.0 imageview 页面 statusbar document
1. UIWebView修改加载页面的字体大小及其它属性
通过实现UIWebViewDelegate的- (void)webViewDidFinishLoad:(UIWebView *)webView来实现
- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSLog(@"webViewDidFinishLoad");
//字体大小
[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.webkitTextSizeAdjust= ‘120%‘"];
//字体颜色
[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.webkitTextFillColor= ‘gray‘"];
//页面背景色
[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.background=‘#2E2E2E‘"];
}
2. 代码实现圆角UIImageView
self.avatarImageView.image = [UIImage imageNamed:@"AvatarDefaultIcon"];
//告诉layer将位于它之下的layer都遮盖住
self.avatarImageView.layer.masksToBounds = YES;
//设置layer的圆角,刚好是自身宽度的一半,这样就成了圆形
self.avatarImageView.layer.cornerRadius = self.avatarImageView.bounds.size.width * 0.5;
//设置边框的宽度为20
self.avatarImageView.layer.borderWidth = 1.0;
//设置边框的颜色
self.avatarImageView.layer.borderColor = [UIColor whiteColor].CGColor;
3. JS与iOS互调
iOS调用JS
JS调用iOS
4. UITableView按内容确定高度
5. 修改导航栏字体颜色
iOS10以后有一些变化,先设置:
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
如果在Attributes Inspector设置了Navigation Bar的"Bar Tint",则上面设置将失效,这个时候需要在
didFinishLaunchingWithOptions里调用:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[UINavigationBar appearance].barStyle = UIBarStyleBlackOpaque;
return YES;
}
标签:失效 字体 ati dict 1.0 imageview 页面 statusbar document
原文地址:http://www.cnblogs.com/wayne23/p/6415680.html