From 83b9d5c682b21d88133f24da0f94dd56bd79e687 Mon Sep 17 00:00:00 2001 From: 单军华 Date: Thu, 19 Jul 2018 13:38:55 +0800 Subject: [PATCH] change --- screendisplay/Pods/CYLTabBarController/CYLTabBarController/UIView+CYLTabBarControllerExtention.m | 142 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 142 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/CYLTabBarController/CYLTabBarController/UIView+CYLTabBarControllerExtention.m b/screendisplay/Pods/CYLTabBarController/CYLTabBarController/UIView+CYLTabBarControllerExtention.m new file mode 100644 index 0000000..5aa605d --- /dev/null +++ b/screendisplay/Pods/CYLTabBarController/CYLTabBarController/UIView+CYLTabBarControllerExtention.m @@ -0,0 +1,142 @@ +// +// CYLTabBarController.m +// CYLTabBarController +// +// v1.16.0 Created by ������@iOS������������ ( http://weibo.com/luohanchenyilong/ ) on 10/20/15. +// Copyright �� 2015 https://github.com/ChenYilong . All rights reserved. +// + +#import <UIKit/UIKit.h> +#import "UIView+CYLTabBarControllerExtention.h" +#import "CYLPlusButton.h" + +@implementation UIView (CYLTabBarControllerExtention) + +- (BOOL)cyl_isPlusButton { + return [self isKindOfClass:[CYLExternPlusButton class]]; +} + +- (BOOL)cyl_isTabButton { + BOOL isKindOfButton = [self cyl_isKindOfClass:[UIControl class]]; + return isKindOfButton; +} + +- (BOOL)cyl_isTabImageView { + BOOL isKindOfImageView = [self cyl_isKindOfClass:[UIImageView class]]; + if (!isKindOfImageView) { + return NO; + } + NSString *subString = [NSString stringWithFormat:@"%@cat%@ew", @"Indi" , @"orVi"]; + BOOL isBackgroundImage = [self cyl_classStringHasSuffix:subString]; + BOOL isTabImageView = !isBackgroundImage; + return isTabImageView; +} + +- (BOOL)cyl_isTabLabel { + BOOL isKindOfLabel = [self cyl_isKindOfClass:[UILabel class]]; + return isKindOfLabel; +} + +- (BOOL)cyl_isTabBadgeView { + BOOL isKindOfClass = [self isKindOfClass:[UIView class]]; + BOOL isClass = [self isMemberOfClass:[UIView class]]; + BOOL isKind = isKindOfClass && !isClass; + if (!isKind) { + return NO; + } + NSString *tabBarClassString = [NSString stringWithFormat:@"%@IB%@", @"_U" , @"adg"]; + BOOL isTabBadgeView = [self cyl_classStringHasPrefix:tabBarClassString];; + return isTabBadgeView; +} + +- (BOOL)cyl_isTabBackgroundView { + BOOL isKindOfClass = [self isKindOfClass:[UIView class]]; + BOOL isClass = [self isMemberOfClass:[UIView class]]; + BOOL isKind = isKindOfClass && !isClass; + if (!isKind) { + return NO; + } + NSString *tabBackgroundViewString = [NSString stringWithFormat:@"%@IB%@", @"_U" , @"arBac"]; + BOOL isTabBackgroundView = [self cyl_classStringHasPrefix:tabBackgroundViewString] && [self cyl_classStringHasSuffix:@"nd"]; + return isTabBackgroundView; +} + +- (UIView *)cyl_tabBadgeBackgroundView { + for (UIImageView *subview in self.subviews) { + if ([subview cyl_isTabBackgroundView]) { + return (UIImageView *)subview; + } + } + return nil; +} + +- (UIView *)cyl_tabBadgeBackgroundSeparator { + UIView *subview = [self cyl_tabBadgeBackgroundView]; + if (!subview) { + return nil; + } + NSArray<__kindof UIView *> *backgroundSubviews = subview.subviews; + if (backgroundSubviews.count > 1) { + for (UIView *tabBadgeBackgroundSeparator in backgroundSubviews) { + if (CGRectGetHeight(tabBadgeBackgroundSeparator.bounds) < 1.0 ) { + return tabBadgeBackgroundSeparator; + } + } + } + return nil; +} + +- (BOOL)cyl_isKindOfClass:(Class)class { + BOOL isKindOfClass = [self isKindOfClass:class]; + BOOL isClass = [self isMemberOfClass:class]; + BOOL isKind = isKindOfClass && !isClass; + if (!isKind) { + return NO; + } + BOOL isTabBarClass = [self cyl_isTabBarClass]; + return isTabBarClass; +} + +- (BOOL)cyl_isTabBarClass { + NSString *tabBarClassString = [NSString stringWithFormat:@"U%@a%@ar", @"IT" , @"bB"]; + BOOL isTabBarClass = [self cyl_classStringHasPrefix:tabBarClassString]; + return isTabBarClass; +} + +- (BOOL)cyl_classStringHasPrefix:(NSString *)prefix { + NSString *classString = NSStringFromClass([self class]); + return [classString hasPrefix:prefix]; +} + +- (BOOL)cyl_classStringHasSuffix:(NSString *)suffix { + NSString *classString = NSStringFromClass([self class]); + return [classString hasSuffix:suffix]; +} + ++ (UIView *)cyl_tabBadgePointViewWithClolor:(UIColor *)color radius:(CGFloat)radius { + UIView *defaultTabBadgePointView = [[UIView alloc] init]; + [defaultTabBadgePointView setTranslatesAutoresizingMaskIntoConstraints:NO]; + defaultTabBadgePointView.backgroundColor = color; + defaultTabBadgePointView.layer.cornerRadius = radius; + defaultTabBadgePointView.layer.masksToBounds = YES; + defaultTabBadgePointView.hidden = YES; + // Width constraint + [defaultTabBadgePointView addConstraint:[NSLayoutConstraint constraintWithItem:defaultTabBadgePointView + attribute:NSLayoutAttributeWidth + relatedBy:NSLayoutRelationEqual + toItem:nil + attribute: NSLayoutAttributeNotAnAttribute + multiplier:1 + constant:radius * 2]]; + // Height constraint + [defaultTabBadgePointView addConstraint:[NSLayoutConstraint constraintWithItem:defaultTabBadgePointView + attribute:NSLayoutAttributeHeight + relatedBy:NSLayoutRelationEqual + toItem:nil + attribute: NSLayoutAttributeNotAnAttribute + multiplier:1 + constant:radius * 2]]; + return defaultTabBadgePointView; +} + +@end -- Gitblit v1.8.0