美文网首页
凸出按钮的TabBar

凸出按钮的TabBar

作者: 吓死宝宝了啊 | 来源:发表于2017-07-05 16:21 被阅读3次

    - (void)addCenterBtn{

    UIImage * image = [UIImage imageNamed:@"money"];

    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];

    [btn setImage:image forState:UIControlStateNormal];

    btn.frame = CGRectMake(0, 0, image.size.width, image.size.height);

    [btn addTarget:self action:@selector(centerClicked) forControlEvents:UIControlEventTouchUpInside];

    //设置凸出按钮的位置

    CGPoint center = self.tabBar.center;

    center.y -= 15;

    btn.center = center;

    //去掉点击按钮时的阴影

    btn.adjustsImageWhenHighlighted = NO;

    [self.view addSubview:btn];

    }

    - (void)centerClicked{

    self.selectedIndex = 1;

    }

    相关文章

      网友评论

          本文标题:凸出按钮的TabBar

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