ChenYilong / CYLTabBarController

[EN]It is an iOS UI module library for adding animation to iOS tabbar items and icons with Lottie, and adding a bigger center UITabBar Item. [CN]【中国特色 TabBar】一行代码实现 Lottie 动画TabBar,支持中间带+号的TabBar样式,自带红点角标,支持动态刷新。【iOS13 & Dark Mode & iPhone XS MAX supported】
MIT License
6.91k stars 1.45k forks source link

怎么把中间按钮弄得跟两边大小一样? #85

Closed Gx952743985 closed 7 years ago

Gx952743985 commented 8 years ago

怎么把中间特殊的按钮弄得跟两边大小一样?怎么弄两个这样不规则的按钮呢

ChenYilong commented 8 years ago

两个按钮暂时还不支持,特殊按钮的尺寸你自己可以设置,慢慢调整下。请问你什么情景下需要使用两个不规则按钮呢?有没有设计图之类的,我之前没考虑过这种情况。

Gx952743985 commented 8 years ago

谢谢你的解答和开源库的分享,这个没有设计图,那只是领导的一个需求:一共五个,中间为不规则(这个你的开源库已经实现),中间和第四个实现按钮实现类似于新浪微博中间按钮那样弹出视图,目前我已经实现了中间那个按钮弹出视图,我只是觉得第四个要是有个按钮就也能很简单的实现了.或者说你有什么更好的建议

ChenYilong commented 8 years ago

中间的,和第四个,实际并不跳转控制器,只是弹出动画?

Gx952743985 commented 8 years ago

是的,只是弹出动画,并不跳转控制器.

ChenYilong commented 8 years ago

参考下这个思路 http://www.jianshu.com/p/7c440689574b , 先这样操作 [self cyl_tabBarController].delegate = self; 然后再代理方法里实现这两个弹出动画。

Gx952743985 commented 8 years ago

好的,非常感谢

Gx952743985 commented 8 years ago

我用了你上面👆说的那个方法,在你的框架中- (BOOL)tabBarController:(UITabBarController )tabBarController shouldSelectViewController:(UIViewController )viewController中每个viewController都是CYLBaseNavigationController,还得麻烦你帮我想想办法

ChenYilong commented 8 years ago

参考这里的做法:https://github.com/ChenYilong/CYLTabBarController/blob/master/CYLTabBarController/CYLTabBarController.m#L257

ChenYilong commented 8 years ago

还有这个:https://github.com/ChenYilong/CYLTabBarController/blob/master/CYLTabBarController/UIViewController%2BCYLTabBarControllerExtention.m#L40

Gx952743985 commented 8 years ago
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{

  //    viewController->_tabBarItem->_title:

  NSLog(@"ddddd--%@",viewController.tabBarItem.title);
  if ([viewController.tabBarItem.title isEqualToString:@"同城"]) {
      NSLog(@"要跳到最后一个ViewController,但是我们返回NO,就不会跳转了");

  return NO;

  }
  return YES;
  }

用这个方法解决了,转给有需要的人