自定义tabbar 中间带个大圆圈

本文介绍了如何自定义一个TabBar,其中包含一个位于中央的大圆圈按钮。通过创建继承自UIView的TabBarView,并添加各种UI控件,如UIButton和UILabel。文中详细讲解了中间圆形View的点击手势处理,以及四个普通按钮的点击事件,通过设置tag值进行区分。同时,还实现了TabBar的隐藏和显示动画效果。
摘要由CSDN通过智能技术生成

先看效果图



第一步 创建tabbarView 继承自 UIView

tabbarview上边需要添加的控件

@property (nonatomic, strong) UIButton *findButton;// 首页按钮

@property (nonatomic, strong) UIButton *lanMuButton;// 栏目按钮

@property (nonatomic, strong) UIButton *huodongButton; 发现按钮

@property (nonatomic, strong) UIButton *wodeButton; 我的按钮

@property (nonatomic, strong) UILabel *findLabel; 首页label

@property (nonatomic, strong) UILabel *lanmuLabel; 栏目label

@property (nonatomic, strong) UILabel *huodonglabel; 活动label

@property (nonatomic, strong) UILabel *wodeLabel; 我的label

@property (nonatomic, strong)UIImageView *centerButton; 中间拍摄按钮


控件的创建和添加代码此处就省略 着重说一下中间大圈是怎么搞得


中间圆形View添加点击手势 在tabbarcontroller中实现

- (void)centerBtnClicked{

    拍照点击的协议方法

    [self.mytabbardelegate centerButtonSelect];

}

    四个button的点击方法 每个button通过设置tag值来区分

- (void)buttonAction:(UIButton *)button{

    if (button.tag == 0) {

         四个button的点击协议方法 在tabbarcontroller中实现

        [self.mytabbardelegate tabbarButtonSelect:0];

         /// 同时变换四个button的图片和label文字的颜色 

        [self.findButton setImage:[UIImage imageNamed:

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值