UITabBar实现中间大按钮
来源:互联网 发布:淘宝便宜建盏是真的吗 编辑:程序博客网 时间:2024/04/23 23:12
原理非常简单,把中间tab bart item的图设为一个大图就可以了。
缺点就是超出tab bar的部分是不能点击的。
//设置tab bar 中间item的图为大图标
UIViewController* vc = [UIViewControllernew];
UINavigationController* nav = [[UINavigationControlleralloc] initWithRootViewController:vc];
[vcs addObject:nav];
nav.tabBarItem.image = [[UIImageimageNamed:@"jdstreetNew_up"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
nav.tabBarItem.selectedImage = [[UIImageimageNamed:@"jdstreetNew_up"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
//隐藏tab bar顶部的分隔线。否则顶部的分隔线将压在中间大图标的上面。
{
//设置tab bar的背景图后setShadowImage才有效。
{
CGRect rect =CGRectMake(0,0, self.view.frame.size.width,44);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context =UIGraphicsGetCurrentContext();
//CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);
CGContextSetFillColorWithColor(context, [[UIColorcolorWithRed:247/255.0
green:247/255.0
blue:247/255.0
alpha:1]CGColor]);
CGContextFillRect(context, rect);
UIImage *img =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.tabBarsetBackgroundImage:img];
}
//将tab bar顶部的分隔线设置为不可见。
[self.tabBar setShadowImage:[UIImage new]];
}
中间tabbar的icon
最后的效果:
- UITabBar实现中间大按钮
- UITabBar自定义方式四(中间无按钮)
- 自定义UITabBar--实现类似新浪微博中间的发送按钮
- UITabBar自定义方式三(中间有按钮)
- UITabBar自定义,顶部曲线,中间按钮突出(OC)
- IOS 定制中间突出UItabBar
- IOS 定制中间突出UItabBar
- iOS 自定制TabBar(中间是一个大按钮)
- 设置UITabBar按钮的颜色
- Android 实现 按钮从两边移到中间动画效果
- ios:点击tabbar中间按钮弹出菜单(swift 3实现)
- 实现底部导航栏中间凸起,(点击中间凸出按钮弹出菜单)
- 底部按钮中间突出
- ios自定义中间凸出 UITabBar,so easy……
- ios自定义中间凸出 UITabBar,so easy……
- UICollectionViewCell水平缩放,中间大两边小效果的实现
- ViewPager中间大两边小效果的实现
- 自定义实现UITabBarController和UITabBar
- Nginx下载简介安装与配置
- 绑定数据 获取值,修改,新增 。记录日志及 获取拼音码及键 回车换行
- OpenStack中magnum组件安装
- Win32 API之Setlocale函数配置地域化信息函数
- MultiValueDictKeyError at/add/错误解决
- UITabBar实现中间大按钮
- android调用系统的相机拍照 、裁剪,然后保存
- Struts2 OGNL
- redis 事务实现原理
- 量化交易
- Npoi导出Excel、读取Excel
- Android之Handler用法总结
- 可能是互联网从业者最好的娱乐方式
- 有关js的一些好文收录——会持续更新