Skip to content

Commit

Permalink
v1.24.0 Do not depend on lottie by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenYilong committed Apr 22, 2019
1 parent 8a3b308 commit 6064638
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 15 deletions.
18 changes: 14 additions & 4 deletions CYLTabBarController.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CYLTabBarController"
s.version = "1.23.1"
s.version = "1.24.0"
s.summary = "Highly customizable tabBar and tabBarController for iOS"
s.description = "CYLTabBarController is iPad and iPhone compatible. Supports landscape and portrait orientations and can be used inside UINavigationController."
s.homepage = "https://github.com/ChenYilong/CYLTabBarController"
Expand All @@ -9,9 +9,19 @@ Pod::Spec.new do |s|
s.social_media_url = 'http://weibo.com/luohanchenyilong/'
s.platform = :ios, '8.0'
s.source = { :git => "https://github.com/ChenYilong/CYLTabBarController.git", :tag => s.version.to_s }
s.source_files = 'CYLTabBarController', 'CYLTabBarController/**/*.{h,m}'
s.public_header_files = 'CYLTabBarController/**/*.h'

s.requires_arc = true
s.dependency "lottie-ios" , '~> 2.5.0'


s.default_subspec = 'Core'

s.subspec 'Core' do |core|
core.source_files = 'CYLTabBarController', 'CYLTabBarController/**/*.{h,m}'
core.public_header_files = 'CYLTabBarController/**/*.h'
end

s.subspec 'Lottie' do |lottie|
lottie.dependency 'CYLTabBarController/Core'
lottie.dependency "lottie-ios" , '~> 2.5.3'
end
end
14 changes: 9 additions & 5 deletions CYLTabBarController/CYLTabBar+CYLTabBarControllerExtention.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
#import <objc/runtime.h>

#import "CYLTabBar.h"
#if __has_include(<Lottie/Lottie.h>)
#import <Lottie/Lottie.h>
#else
#endif


@implementation CYLTabBar (CYLTabBarControllerExtention)
Expand Down Expand Up @@ -153,14 +156,10 @@ - (UIControl *)cyl_visibleControlWithIndex:(NSUInteger)index {
return selectedControl;
}

//- (void)cyl_animationLottieImageWithSelectedIndex:(NSUInteger)selectedIndex {
// UIControl *selectedControl = [self cyl_subTabBarButtonWithIndex:selectedIndex];
// [self cyl_animationLottieImageWithSelectedControl:selectedControl];
//}

- (void)cyl_animationLottieImageWithSelectedControl:(UIControl *)selectedControl
lottieURL:(NSURL *)lottieURL
size:(CGSize)size {
#if __has_include(<Lottie/Lottie.h>)
[selectedControl cyl_addLottieImageWithLottieURL:lottieURL size:size];
[self cyl_stopAnimationOfAllLottieView];
LOTAnimationView *lottieView = selectedControl.cyl_lottieAnimationView;
Expand All @@ -171,12 +170,17 @@ - (void)cyl_animationLottieImageWithSelectedControl:(UIControl *)selectedControl
lottieView.animationProgress = 0;
[lottieView play];
}
#else
#endif
}

- (void)cyl_stopAnimationOfAllLottieView {
#if __has_include(<Lottie/Lottie.h>)
[self.cyl_visibleControls enumerateObjectsUsingBlock:^(UIControl * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
[obj.cyl_lottieAnimationView stop];
}];
#else
#endif
}

@end
3 changes: 3 additions & 0 deletions CYLTabBarController/CYLTabBarController.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
#import "UIViewController+CYLTabBarControllerExtention.h"
#import "UIControl+CYLTabBarControllerExtention.h"
#import "UIImage+CYLTabBarControllerExtention.h"
#if __has_include(<Lottie/Lottie.h>)
#import <Lottie/Lottie.h>
#else
#endif

NSString *const CYLTabBarItemTitle = @"CYLTabBarItemTitle";
NSString *const CYLTabBarItemImage = @"CYLTabBarItemImage";
Expand Down
5 changes: 3 additions & 2 deletions CYLTabBarController/UIControl+CYLTabBarControllerExtention.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
#import "UIView+CYLTabBarControllerExtention.h"
#import "CYLConstants.h"
#import "CYLTabBarController.h"
#if __has_include(<Lottie/Lottie.h>)
#import <Lottie/Lottie.h>
#else
#endif

@implementation UIControl (CYLTabBarControllerExtention)

Expand Down Expand Up @@ -321,9 +324,7 @@ - (void)cyl_addLottieImageWithLottieURL:(NSURL *)lottieURL
lottieView.translatesAutoresizingMaskIntoConstraints = NO;
[lottieView setClipsToBounds:NO];
[tabButton cyl_replaceTabImageViewWithNewView:lottieView show:YES];

#else
return;
#endif

}
Expand Down
3 changes: 3 additions & 0 deletions CYLTabBarController/UIView+CYLTabBarControllerExtention.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
#import <UIKit/UIKit.h>
#import "UIView+CYLTabBarControllerExtention.h"
#import "CYLPlusButton.h"
#if __has_include(<Lottie/Lottie.h>)
#import <Lottie/Lottie.h>
#else
#endif

@implementation UIView (CYLTabBarControllerExtention)

Expand Down
4 changes: 3 additions & 1 deletion Example/CYLMainRootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
#import "CYLMainRootViewController.h"
#import "MainTabBarController.h"
#import "CYLPlusButtonSubclass.h"

#if __has_include(<Lottie/Lottie.h>)
#import <Lottie/Lottie.h>
#else
#endif

#define RANDOM_COLOR [UIColor colorWithHue: (arc4random() % 256 / 256.0) saturation:((arc4random()% 128 / 256.0 ) + 0.5) brightness:(( arc4random() % 128 / 256.0 ) + 0.5) alpha:1]

Expand Down
6 changes: 3 additions & 3 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ source '[email protected]:CocoaPods/Specs.git'
target 'CYLTabBarController' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
#pod 'lottie-ios', '~> 2.5.0'
pod 'CYLTabBarController', :path => './'
#pod 'CYLTabBarController', '~> 1.23.1'

#pod 'CYLTabBarController', '~> 1.24.0' # 默认不依赖Lottie
pod 'CYLTabBarController/Lottie', '~> 1.24.0' # 依赖Lottie库

end

0 comments on commit 6064638

Please sign in to comment.