Skip to content

Commit 076974b

Browse files
committed
v1.17.14 fix ChenYilong#285 and add animate for cyl_popSelectTabBarChildViewControllerAtIndex
1 parent 5ab213b commit 076974b

4 files changed

+18
-4
lines changed

CYLTabBarController.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "CYLTabBarController"
3-
s.version = "1.17.13"
3+
s.version = "1.17.14"
44
s.summary = "Highly customizable tabBar and tabBarController for iOS"
55
s.description = "CYLTabBarController is iPad and iPhone compatible. Supports landscape and portrait orientations and can be used inside UINavigationController."
66
s.homepage = "https://github.com/ChenYilong/CYLTabBarController"

CYLTabBarController/CYLTabBar.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,8 @@ - (void)setupTabImageViewDefaultOffset:(UIView *)tabBarButton {
363363
*/
364364
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
365365
//1. 边界情况:不能响应点击事件
366-
BOOL canNotResponseEvent = self.hidden || (self.alpha <= 0.01f) || (self.userInteractionEnabled == NO);
366+
367+
BOOL canNotResponseEvent = self.hidden || (self.alpha <= 0.01f) || (self.userInteractionEnabled == NO) || (!self.superview) || self.frame.size.width == 0 || self.frame.size.height == 0;
367368
if (canNotResponseEvent) {
368369
return nil;
369370
}

CYLTabBarController/UIViewController+CYLTabBarControllerExtention.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,19 @@ typedef void (^CYLPushOrPopCallback)(NSArray<__kindof UIViewController *> *viewC
4949
* Pop 到当前 `NavigationController` 的栈底,并改变 `TabBarController` 的 `selectedViewController` 属性,并将被选择的控制器作为返回值返回。
5050
@param index 需要选择的控制器在 `TabBar` 中的 index。
5151
@return 最终被选择的控制器。
52-
@attention 注意:方法中的参数和返回值都是 `UIViewController` 的子类,但并非 `UINavigationController` 的子类。
52+
@attention 注意:方法中的参数和返回值都是 `UIViewController` 的子类,但并非 `UINavigationController` 的子类,该方法无 pop 动画
5353
*/
5454
- (UIViewController *)cyl_popSelectTabBarChildViewControllerAtIndex:(NSUInteger)index;
5555

56+
/*!
57+
* Pop 到当前 `NavigationController` 的栈底,并改变 `TabBarController` 的 `selectedViewController` 属性,并将被选择的控制器作为返回值返回。
58+
@param index 需要选择的控制器在 `TabBar` 中的 index。
59+
@param animated 动画
60+
@return 最终被选择的控制器。
61+
@attention 注意:方法中的参数和返回值都是 `UIViewController` 的子类,但并非 `UINavigationController` 的子类。
62+
*/
63+
- (UIViewController *)cyl_popSelectTabBarChildViewControllerAtIndex:(NSUInteger)index animated:(BOOL)animated;
64+
5665
/*!
5766
* Pop 到当前 `NavigationController` 的栈底,并改变 `TabBarController` 的 `selectedViewController` 属性,并将被选择的控制器在 `Block` 回调中返回。
5867
@param index 需要选择的控制器在 `TabBar` 中的 index。

CYLTabBarController/UIViewController+CYLTabBarControllerExtention.m

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ @implementation UIViewController (CYLTabBarControllerExtention)
1616
#pragma mark - public Methods
1717

1818
- (UIViewController *)cyl_popSelectTabBarChildViewControllerAtIndex:(NSUInteger)index {
19+
return [self cyl_popSelectTabBarChildViewControllerAtIndex:index animated:NO];
20+
}
21+
22+
- (UIViewController *)cyl_popSelectTabBarChildViewControllerAtIndex:(NSUInteger)index animated:(BOOL)animated {
1923
UIViewController *viewController = [self cyl_getViewControllerInsteadOfNavigationController];
2024
[viewController checkTabBarChildControllerValidityAtIndex:index];
2125
CYLTabBarController *tabBarController = [viewController cyl_tabBarController];
2226
tabBarController.selectedIndex = index;
23-
[viewController.navigationController popToRootViewControllerAnimated:NO];
27+
[viewController.navigationController popToRootViewControllerAnimated:animated];
2428
UIViewController *selectedTabBarChildViewController = tabBarController.selectedViewController;
2529
return [selectedTabBarChildViewController cyl_getViewControllerInsteadOfNavigationController];
2630
}

0 commit comments

Comments
 (0)