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/UIControl+CYLTabBarControllerExtention.m |  133 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 133 insertions(+), 0 deletions(-)

diff --git a/screendisplay/Pods/CYLTabBarController/CYLTabBarController/UIControl+CYLTabBarControllerExtention.m b/screendisplay/Pods/CYLTabBarController/CYLTabBarController/UIControl+CYLTabBarControllerExtention.m
new file mode 100644
index 0000000..1ae5ceb
--- /dev/null
+++ b/screendisplay/Pods/CYLTabBarController/CYLTabBarController/UIControl+CYLTabBarControllerExtention.m
@@ -0,0 +1,133 @@
+//
+//  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 "UIControl+CYLTabBarControllerExtention.h"
+#import <objc/runtime.h>
+#import "UIView+CYLTabBarControllerExtention.h"
+#import "CYLConstants.h"
+
+@implementation UIControl (CYLTabBarControllerExtention)
+
+- (void)cyl_showTabBadgePoint {
+    [self cyl_setShowTabBadgePointIfNeeded:YES];
+}
+
+- (void)cyl_removeTabBadgePoint {
+    [self cyl_setShowTabBadgePointIfNeeded:NO];
+}
+
+- (BOOL)cyl_isShowTabBadgePoint {
+    return !self.cyl_tabBadgePointView.hidden;
+}
+
+- (void)cyl_setShowTabBadgePointIfNeeded:(BOOL)showTabBadgePoint {
+    @try {
+        [self cyl_setShowTabBadgePoint:showTabBadgePoint];
+    } @catch (NSException *exception) {
+        NSLog(@"CYLPlusChildViewController do not support set TabBarItem red point");
+    }
+}
+
+- (void)cyl_setShowTabBadgePoint:(BOOL)showTabBadgePoint {
+    if (showTabBadgePoint && self.cyl_tabBadgePointView.superview == nil) {
+        [self addSubview:self.cyl_tabBadgePointView];
+        [self bringSubviewToFront:self.cyl_tabBadgePointView];
+        self.cyl_tabBadgePointView.layer.zPosition = MAXFLOAT;
+        // X constraint
+        [self addConstraint:
+         [NSLayoutConstraint constraintWithItem:self.cyl_tabBadgePointView
+                                      attribute:NSLayoutAttributeCenterX
+                                      relatedBy:0
+                                         toItem:self.cyl_tabImageView
+                                      attribute:NSLayoutAttributeRight
+                                     multiplier:1
+                                       constant:self.cyl_tabBadgePointViewOffset.horizontal]];
+        //Y constraint
+        [self addConstraint:
+         [NSLayoutConstraint constraintWithItem:self.cyl_tabBadgePointView
+                                      attribute:NSLayoutAttributeCenterY
+                                      relatedBy:0
+                                         toItem:self.cyl_tabImageView
+                                      attribute:NSLayoutAttributeTop
+                                     multiplier:1
+                                       constant:self.cyl_tabBadgePointViewOffset.vertical]];
+    }
+    self.cyl_tabBadgePointView.hidden = showTabBadgePoint == NO;
+    self.cyl_tabBadgeView.hidden = showTabBadgePoint == YES;
+}
+
+- (void)cyl_setTabBadgePointView:(UIView *)tabBadgePointView {
+    UIView *tempView = objc_getAssociatedObject(self, @selector(cyl_tabBadgePointView));
+    if (tempView) {
+        [tempView removeFromSuperview];
+    }
+    if (tabBadgePointView.superview) {
+        [tabBadgePointView removeFromSuperview];
+    }
+    
+    tabBadgePointView.hidden = YES;
+    objc_setAssociatedObject(self, @selector(cyl_tabBadgePointView), tabBadgePointView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+- (UIView *)cyl_tabBadgePointView {
+    UIView *tabBadgePointView = objc_getAssociatedObject(self, @selector(cyl_tabBadgePointView));
+    
+    if (tabBadgePointView == nil) {
+        tabBadgePointView = self.cyl_defaultTabBadgePointView;
+        objc_setAssociatedObject(self, @selector(cyl_tabBadgePointView), tabBadgePointView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+    }
+    return tabBadgePointView;
+}
+
+- (void)cyl_setTabBadgePointViewOffset:(UIOffset)tabBadgePointViewOffset {
+    objc_setAssociatedObject(self, @selector(cyl_tabBadgePointViewOffset), [NSValue valueWithUIOffset:tabBadgePointViewOffset], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+//offset���������������������������������������
+- (UIOffset)cyl_tabBadgePointViewOffset {
+    id tabBadgePointViewOffsetObject = objc_getAssociatedObject(self, @selector(cyl_tabBadgePointViewOffset));
+    UIOffset tabBadgePointViewOffset = [tabBadgePointViewOffsetObject UIOffsetValue];
+    return tabBadgePointViewOffset;
+}
+
+- (UIView *)cyl_tabBadgeView {
+    for (UIView *subview in self.subviews) {
+        if ([subview cyl_isTabBadgeView]) {
+            return (UIView *)subview;
+        }
+    }
+    return nil;
+}
+
+- (UIImageView *)cyl_tabImageView {
+    for (UIImageView *subview in self.subviews) {
+        if ([subview cyl_isTabImageView]) {
+            return (UIImageView *)subview;
+        }
+    }
+    return nil;
+}
+
+- (UILabel *)cyl_tabLabel {
+    for (UILabel *subview in self.subviews) {
+        if ([subview cyl_isTabLabel]) {
+            return (UILabel *)subview;
+        }
+    }
+    return nil;
+}
+
+#pragma mark - private method
+
+- (UIView *)cyl_defaultTabBadgePointView {
+    UIView *defaultRedTabBadgePointView = [UIView cyl_tabBadgePointViewWithClolor:[UIColor redColor] radius:4.5];
+    return defaultRedTabBadgePointView;
+}
+
+@end
+

--
Gitblit v1.8.0