美文网首页IOS 学习
OC-UITabBar上相关设置

OC-UITabBar上相关设置

作者: SK丿希望 | 来源:发表于2019-03-27 10:31 被阅读0次
  • 去掉黑线
[UITabBar appearance].barStyle = UIBarStyleBlack;
  • 自定义黑线颜色
CGRect rect = CGRectMake(0, 0, [UIApplication sharedApplication].keyWindow.bounds.size.width, 1);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[UITabBar appearance].shadowImage = image;
  • 设置背景色
[UITabBar appearance].backgroundColor = hw_BGColor;
  • 自定义背景图片
[UITabBar appearance].backgroundImage = [UIImage imageNamed:@"TabBar_BG"];
  • 设置字体偏移
[UITabBarItem appearance].titlePositionAdjustment = UIOffsetMake(0.0,0.0);
  • 字体
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]} forState:UIControlStateNormal];
  • 未选中颜色
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:self.normalColor} forState:UIControlStateNormal];
  • 选中颜色
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:self.selectColor} forState:UIControlStateSelected];

注意:有点设置无限需要将[UITabBar appearance].translucent = YES;才可以

  • NavigationController 隐藏黑线
self.navigationBar.barStyle = UIBaselineAdjustmentNone;

相关文章

  • OC-UITabBar上相关设置

    去掉黑线 自定义黑线颜色 设置背景色 自定义背景图片 设置字体偏移 字体 未选中颜色 选中颜色 注意:有点设置无限...

  • ios 更改statusBarStyle

    IOS上 关于状态栏的相关设置(UIStatusBar) 设置statusBar的【前景部分】 简单来说,就是设置...

  • Android绘图之drawText绘制文本相关(4)

    Android 绘图学习 绘制文字相关:Paint 相关设置,Canvas相关设置。 1 Paint绘制文字相关:...

  • CSSday06笔记

    一、外边距 1. 外边距属性 margin属性用于设置内边距,也是复合属性,相关设置如下 margin-top:上...

  • EditText 相关设置

    1. 设置 整数或小数 以及相关位数 1.1 过程中 设置校验规则 设置相关位数 1.2 提交 设置校验规则 其他...

  • flex布局

    练习flex相关属性用法可以在浏览器开发者工具上练习 可以设置在容器(.boxes)上的属性 可以设置在容器(.b...

  • TextView设置drawable设置相关

    xml里设置 android:drawableRight="@mipmap/company_expand_down...

  • Eclipse 相关设置

    Eclipse中出现红色下划波浪线解决方法 解决步骤:Windows->Preferences->General-...

  • WebView相关设置

    重定向问题 通过setWebViewClient方法重写WebViewClientEx内部的shouldOverr...

  • UITextField相关设置

    设置UITextField的最大长度 协议: 设置代理:textField.delegate = self;执行方法:

网友评论

    本文标题:OC-UITabBar上相关设置

    本文链接:https://www.haomeiwen.com/subject/jsvavqtx.html