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

按照 “点击 PlusButton 跳转到指定 UIViewController” 添加控制器,不能实现描述的结果 #59

Closed Guodadada closed 5 years ago

Guodadada commented 8 years ago

操作流程重现:

  1. 前提:CYLTabBarControllers 中4个控制器,加上plusButton一共有5个。tabBarItemsAttributes中4个。
  2. 给plusButton 按照“点击 PlusButton 跳转到指定 UIViewController ”中的方法设置,会出现 tabBarItemsAttributes 数组越界。
  3. 解决:给 tabBarItemsAttributes 添加一个元素到5个元素。
  4. 运行会崩到“The count of CYLTabBarControllers is not equal to the count of tabBarItemsAttributes.”。

看文档没有提到这种问题,尝试解决没有成功

ChenYilong commented 8 years ago

请提供详细的崩溃操作步骤,请问能否提供一个复现的demo,我的邮箱luohanchenyilong@163.com

ChenYilong commented 8 years ago

如果你的 plusButton 是在放在tabBar的最后一个,那么实现代理时需要这样指定:

+ (NSUInteger)indexOfPlusButtonInTabBar {
    return 4;
}

我试了这样没问题,不知道你的crash具体是怎么产生的?

Guodadada commented 8 years ago

下午一直在忙,闲了一下偷偷看了gitHub,发现有两条回复,瞬间不好意思了。。。 是这样的:

  1. 要实现的效果是文档里边的 “实现当点击plusButton的时候,像点击别的TabBarItem一样的效果”。
  2. 我尝试文档里边提到的两个代理方法:1. 设置indexOfPlusButtonInTabBar; 2. 设置plusChildViewController。
  3. 忘记说前提了。。tabBar配置文件中 添加了4个子控制器。
  4. 运行就会出现第一次提到的崩溃问题,不知道我描述清楚了没,如果没有,晚上我整理一份demo出来。。。
ChenYilong commented 8 years ago

你先确保使用的是最新版吧,我试了试你说的这种情况,我这边没有复现。