zzb 4 년 전
부모
커밋
e3e095da1d

+ 6 - 0
ZZUIKit.podspec

@@ -47,6 +47,12 @@ TODO: Add long description of the pod here.
     'ZZUIKit/Classes/ZZTextImgView/*',
     'ZZUIKit/Classes/ZZTextWidget/*',
     'ZZUIKit/Classes/ZZViewController/*',
+    'ZZUIKit/Classes/ZZInfoWidget/*',
+    'ZZUIKit/Classes/ZZSwitchWidget/*',
+    'ZZUIKit/Classes/ZZCheckBox/*',
+    'ZZUIKit/Classes/ZZRaido/*',
+    'ZZUIKit/Classes/ZZSelect/*',
+    'ZZUIKit/Classes/ZZOption/*',
     ]
   
   s.resource_bundles = {

+ 6 - 0
ZZUIKit/Assets/XML/ZZCheckBox.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<UIView name="wrapper" attr=""
+    layout="flex:1,flexDirection:row,justifyContent:flex-start,alignItems:center">
+    <UIImageView name="imgV" attr="source:," layout="width:20,aspectRatio:1,margin:0/0/10/0"/>
+    <UILabel name="title" layout="flex:1," attr="font:PingFangSC-Regular|15,color:#333333,text:选项"/>
+</UIView>

+ 1 - 1
ZZUIKit/Assets/XML/ZZInfoItem.xml

@@ -54,4 +54,4 @@
     </UIView>
 
     
-</UIView>
+</UIView>

+ 12 - 0
ZZUIKit/Assets/XML/ZZInfoWidget.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<UIView layout="flex:1" attr="">
+    <!-- content -->
+    <UIView name="contentWrapper" 
+        layout="flex:1,flexDirection:row,justifyContent:space-between,alignItems:center,padding:15/0/15/0">
+        <UILabel name="title" attr="font:PingFangSC-Regular|15,color:#333333,text:标题"/>
+        <UITextField name="field" layout="flex:1,alignSelf:stretch" attr="fontSize:14,color:black,textAlign:right,placeholder:请输入,text:"/>
+    </UIView>
+    <!-- line -->
+    <UIView name="line" layout="height:1,width:100%" attr="bgColor:#E9E9E9"></UIView>
+</UIView>

+ 13 - 0
ZZUIKit/Assets/XML/ZZSwitchWidget.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<UIView layout="flex:1,flexDirection:row,justifyContent:space-between,alignItems:center" attr="">
+    <UILabel name="title" attr="font:PingFangSC-Regular|15,color:#4B7AEA,text:标题"/>
+
+    <UIView layout=",position:relative,width:50,height:30" attr="">
+        <UISwitch name="toggle" layout="position:absolute" attr="on:false"/>
+        <UILabel name="toggleLabel" layout="position:absolute,left:-2,height:0,width:30,height:100%" 
+            attr="font:PingFangSC-Regular|12,color:#ffffff,text:是,textAlign:center"/>
+        <UILabel name="toggleOffLabel" layout="position:absolute,right:-2,height:0,width:30,height:100%" 
+            attr="font:PingFangSC-Regular|12,color:#ffffff,text:否,textAlign:center"/>
+    </UIView>
+</UIView>

+ 40 - 0
ZZUIKit/Classes/ZZCheckBox/ZZCheckBox.h

@@ -0,0 +1,40 @@
+//
+//  ZZCheckBox.h
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/3.
+//
+
+#import <FlexLib/FlexLib.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ZZCheckBox : FlexCustomBaseView
+
+/// 选中的状态
+@property(nonatomic,assign) BOOL selected;
+/// 能不能反转
+@property(nonatomic,assign) BOOL reverse;
+/// 点击回调blcok
+@property(nonatomic,copy) void(^clickEvent)(ZZCheckBox *box);
+/// 图片控件;无图片的时候隐藏
+@property(nonatomic,strong) UIImageView *imgV;
+/// 文本
+@property(nonatomic,strong) UILabel *title;
+/// xml创建的View
+@property(nonatomic,strong) UIView *wrapper;
+
+//#pragma mark -- 无图片的属性
+///// 选中的背景色
+//@property(nonatomic,copy) NSString *selBgc;
+//@property(nonatomic,copy) NSString *unselBgc;
+//@property(nonatomic,copy) NSString *selBorderColor;
+//@property(nonatomic,copy) NSString *unselBorderColor;
+//#pragma mark -- 有图片的属性
+@property(nonatomic,strong) UIImage *selImg;
+@property(nonatomic,strong) UIImage *unselImg;
+/// 发送radio广播
+-(void)postRadioNotification;
+@end
+
+NS_ASSUME_NONNULL_END

+ 82 - 0
ZZUIKit/Classes/ZZCheckBox/ZZCheckBox.m

@@ -0,0 +1,82 @@
+//
+//  ZZCheckBox.m
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/3.
+//
+
+#import "ZZCheckBox.h"
+#import <ZZUIKit/ZZUIKitEx.h>
+
+@interface ZZCheckBox()
+
+@end
+
+@implementation ZZCheckBox
+
+-(NSBundle *)bundleForRes{
+    NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+    NSURL *bundleURL = [bundle URLForResource:@"ZZUIKit" withExtension:@"bundle"];
+    NSBundle *resourceBundle = [NSBundle bundleWithURL: bundleURL];
+    return resourceBundle;
+}
+
+-(void)onInit{
+    _imgV.hidden = true;
+    _selected = false;
+    _reverse = true;
+    _title.textAlignment = NSTextAlignmentLeft;
+    @weakify(self);
+    self.zz_tapAction(^(UIView *view){
+        @strongify(self);
+        [self onClick];
+    });
+}
+
+-(void)postRadioNotification{
+    if ([self.superview isKindOfClass:NSClassFromString(@"ZZRadio")]) {
+        [self.superview performSelector:@selector(onClick)];
+    }
+}
+
+-(void)onClick{
+    if (_clickEvent) {/*自定义点击逻辑*/
+        _clickEvent(self);
+    }else{/*默认自带逻辑*/
+        self.selected = _reverse ? !_selected : true;
+        if (self.selected) {[self postRadioNotification];}
+    }
+}
+
+-(void)setSelected:(BOOL)selected{
+    _selected = selected;
+    _imgV.image = _selected ? self.selImg : self.unselImg;
+}
+
+FLEXSET(reverse){
+    self.reverse = String2BOOL(sValue);
+}
+
+FLEXSET(selected){
+    self.selected = String2BOOL(sValue);
+}
+
+#pragma mark -- 图片样式
+FLEXSET(selImg){
+    UIImage* img = [UIImage imageNamed:sValue inBundle:[owner bundleForImages] compatibleWithTraitCollection:nil];
+    self.selImg = img;
+    self.imgV.hidden = false;
+    self.selected = self.selected;
+}
+
+FLEXSET(unselImg){
+    UIImage* img = [UIImage imageNamed:sValue inBundle:[owner bundleForImages] compatibleWithTraitCollection:nil];
+    self.unselImg = img;
+    self.imgV.hidden = false;
+    self.selected = self.selected;
+}
+
+FLEXSET(title){
+    self.title.text = sValue;
+}
+@end

+ 3 - 0
ZZUIKit/Classes/ZZDialog/ZZDialog.m

@@ -26,7 +26,9 @@
     _handleDelegate = handleDelegate;
     _handleView.frame = [handleDelegate preferredFrameForHandleInDialog:self];
     NSArray *dicArr = [handleDelegate itemsForHandleInDialog:self];
+//    @weakify(self);
     [dicArr enumerateObjectsUsingBlock:^(NSDictionary *itemDic, NSUInteger idx, BOOL * _Nonnull stop) {
+//        @strongify(self);
         UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
         
         NSString *title = itemDic[ZZTitleKey];
@@ -44,6 +46,7 @@
         }
         
         void(^click)(void) = itemDic[ZZActionKey];
+        
         btn.zz_click(^(UIControl *control){
             click();
         });

+ 1 - 1
ZZUIKit/Classes/ZZDialog/ZZDialogViewController.h

@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @end
 
-@interface ZZDialogViewController : ZZViewController
+@interface ZZDialogViewController : ZZViewController<ZZDialogDelegate,ZZDialogHandleDelegate>
 @property(nonatomic,strong,readonly) ZZDialog *dialog;
 @property(nonatomic,weak,nullable) id<ZZDialogDelegate> dialogDelegate;
 @property(nonatomic,weak,nullable) id<ZZDialogHandleDelegate> handleDelegate;

+ 5 - 2
ZZUIKit/Classes/ZZDialog/ZZDialogViewController.m

@@ -9,7 +9,7 @@
 #import "ZZUIKitEx.h"
 #import "ZZMaskView.h"
 
-@interface ZZDialogViewController ()<ZZDialogDelegate,ZZDialogHandleDelegate>
+@interface ZZDialogViewController ()
 @property(nonatomic,strong,readwrite) ZZDialog *dialog;
 @property(nonatomic,strong) ZZMaskView *maskView;
 @end
@@ -39,6 +39,8 @@
     self.maskView.zz_tapAction(^(UIView *v){
       [weakSelf.dialog dismiss];
     });
+    self.dialogDelegate = self;
+    self.handleDelegate = self;
 }
 
 - (void)awakeFromNib{
@@ -46,7 +48,8 @@
 }
 
 -(void)viewDidLoad{
-   [self.view addSubview:self.dialog];
+    [super viewDidLoad];
+    [self.view addSubview:self.dialog];
 }
 
 

+ 23 - 0
ZZUIKit/Classes/ZZInfoWidget/ZZInfoWidget.h

@@ -0,0 +1,23 @@
+//
+//  ZZInfoWidget.h
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/3.
+//
+
+#import <FlexLib/FlexLib.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ZZInfoWidget : FlexCustomBaseView
+/// 标题
+@property(nonatomic,strong) UILabel *title;
+/// 输入框
+@property(nonatomic,strong) UITextField *field;
+/// title 和 field的容器
+@property(nonatomic,strong) UIView *contentWrapper;
+/// 下划线
+@property(nonatomic,strong) UIView *line;
+@end
+
+NS_ASSUME_NONNULL_END

+ 39 - 0
ZZUIKit/Classes/ZZInfoWidget/ZZInfoWidget.m

@@ -0,0 +1,39 @@
+//
+//  ZZInfoWidget.m
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/3.
+//
+
+#import "ZZInfoWidget.h"
+
+@implementation ZZInfoWidget
+
+-(NSBundle *)bundleForRes{
+    NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+    NSURL *bundleURL = [bundle URLForResource:@"ZZUIKit" withExtension:@"bundle"];
+    NSBundle *resourceBundle = [NSBundle bundleWithURL: bundleURL];
+    return resourceBundle;
+}
+
+-(void)onInit{
+
+}
+
+FLEXSET(title){
+    self.title.text = sValue;
+}
+
+FLEXSET(placeholder){
+    self.field.placeholder = sValue;
+}
+
+FLEXSET(edit){
+    self.field.enabled = String2BOOL(sValue);
+}
+
+FLEXSET(line){
+    self.line.hidden = String2BOOL(sValue);
+}
+
+@end

+ 36 - 0
ZZUIKit/Classes/ZZOption/ZZOption.h

@@ -0,0 +1,36 @@
+//
+//  ZZOption.h
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/9.
+//
+
+#import <FlexLib/FlexLib.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ZZOption : FlexCustomBaseView
+/// 选中的状态
+@property(nonatomic,assign) BOOL selected;
+/// 能不能反转
+@property(nonatomic,assign) BOOL reverse;
+/// 点击回调blcok
+@property(nonatomic,copy) void(^clickEvent)(ZZOption *box);
+
+/// 文本
+@property(nonatomic,strong) UILabel *title;
+#pragma mark -- 无图片的属性
+/// 选中的背景色
+@property(nonatomic,copy) NSString *selBgc;
+@property(nonatomic,copy) NSString *unselBgc;
+@property(nonatomic,copy) NSString *selBorderColor;
+@property(nonatomic,copy) NSString *unselBorderColor;
+/// 选中文字的颜色
+@property(nonatomic,copy) NSString *selTextColor;
+@property(nonatomic,copy) NSString *unselTextColor;
+
+/// 发送radio广播
+-(void)postRadioNotification;
+@end
+
+NS_ASSUME_NONNULL_END

+ 117 - 0
ZZUIKit/Classes/ZZOption/ZZOption.m

@@ -0,0 +1,117 @@
+//
+//  ZZOption.m
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/9.
+//
+
+#import "ZZOption.h"
+#import <ZZUIKit/ZZUIKitEx.h>
+
+@implementation ZZOption
+
+//-(NSBundle *)bundleForRes{
+//    NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+//    NSURL *bundleURL = [bundle URLForResource:@"ZZUIKit" withExtension:@"bundle"];
+//    NSBundle *resourceBundle = [NSBundle bundleWithURL: bundleURL];
+//    return resourceBundle;
+//}
+
+-(UILabel *)title{
+    if(!_title){
+        _title = [[UILabel alloc] init];
+        _title.textAlignment = NSTextAlignmentCenter;
+        [_title setLayoutAttr:@"flex" Value:@"1"];
+        [_title enableFlexLayout:true];
+    }
+    return _title;
+}
+
+-(void)onInit{
+    _selTextColor = @"#333333";
+    _unselTextColor = @"#333333";
+    _reverse = true;
+    UIView *frameView = [self valueForKey:@"frameView"];
+    [frameView addSubview:self.title];
+    self.selected = false;
+    @weakify(self);
+    self.zz_tapAction(^(UIView *view){
+        @strongify(self);
+        [self onClick];
+    });
+}
+
+-(void)postRadioNotification{
+    if ([self.superview isKindOfClass:NSClassFromString(@"ZZSelect")] || [self.superview isKindOfClass:NSClassFromString(@"ZZRadio")]) {
+        [self.superview performSelector:@selector(onClick)];
+    }
+}
+
+-(void)onClick{
+    if (_clickEvent) {/*自定义点击逻辑*/
+        _clickEvent(self);
+    }else{/*默认自带逻辑*/
+        self.selected = _reverse ? !_selected : true;
+        [self postRadioNotification];
+    }
+}
+
+-(void)setSelected:(BOOL)selected{
+    _selected = selected;
+     if (!_selBorderColor) {
+       _selBorderColor = _selBgc;
+    }
+    if (!_unselBorderColor) {
+       _unselBorderColor = _unselBgc;
+    }
+    self.layer.borderColor = _selected ? colorFromString(_selBorderColor, nil).CGColor:colorFromString(_unselBorderColor, nil).CGColor;
+    self.layer.borderWidth = 1;
+    
+    if (_selBgc && _unselBgc) {
+        self.backgroundColor = _selected ?colorFromString(_selBgc, nil):colorFromString(_unselBgc, nil);
+    }
+    self.title.textColor = _selected ? colorFromString(_selTextColor, nil) : colorFromString(_unselTextColor, nil);
+}
+
+FLEXSET(reverse){
+    self.reverse = String2BOOL(sValue);
+}
+
+FLEXSET(selected){
+    self.selected = String2BOOL(sValue);
+}
+
+FLEXSET(selTextColor){
+    self.selTextColor = sValue;
+    self.selected = self.selected;
+}
+
+FLEXSET(unselTextColor){
+    self.unselTextColor = sValue;
+    self.selected = self.selected;
+}
+
+FLEXSET(selBgc){
+    self.selBgc = sValue;
+    self.selected = self.selected;
+}
+
+FLEXSET(unselBgc){
+    self.unselBgc = sValue;
+    self.selected = self.selected;
+}
+
+FLEXSET(selBorderColor){
+    self.selBorderColor = sValue;
+    self.selected = self.selected;
+}
+
+FLEXSET(unselBorderColor){
+    self.unselBorderColor = sValue;
+    self.selected = self.selected;
+}
+
+FLEXSET(title){
+    self.title.text = sValue;
+}
+@end

+ 21 - 0
ZZUIKit/Classes/ZZRaido/ZZRadio.h

@@ -0,0 +1,21 @@
+//
+//  ZZRadio.h
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/3.
+//
+
+#import <ZZUIKit/ZZCheckBox.h>
+#import <ZZUIKit/UIView+ZZEx.h>
+
+#define ZZRadioNotification(label) [NSString stringWithFormat:@"%pRadioNotification%@",[self zz_viewController],label]
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// 同一个页面不相干的label不要重复使用
+@interface ZZRadio : FlexCustomBaseView
+@property(nonatomic,copy,nullable) NSString * selectStr;
+@property(nonatomic,copy,nullable) void(^selectedBlock)(NSString * nullable);
+@end
+
+NS_ASSUME_NONNULL_END

+ 83 - 0
ZZUIKit/Classes/ZZRaido/ZZRadio.m

@@ -0,0 +1,83 @@
+//
+//  ZZRadio.m
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/3.
+//
+
+#import "ZZRadio.h"
+#import <ZZUIKit/ZZCheckBox.h>
+
+@interface ZZRadio()
+@property(nonatomic,strong) NSMutableArray *itemArr;
+@property(nonatomic,copy) NSArray <NSString *> * labels;
+@end
+
+@implementation ZZRadio
+
+- (void)onInit{
+    _itemArr = [NSMutableArray array];
+    
+}
+
+FLEXSET(label){
+    self.labels = [sValue componentsSeparatedByString:@"/"];
+    
+}
+
+- (void)willMoveToWindow:(UIWindow *)newWindow{
+    for (NSString *str in self.labels) {
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveRadio:) name:ZZRadioNotification(str) object:nil];
+    }
+}
+
+-(void)onClick{
+    for (NSString *str in self.labels) {
+        [[NSNotificationCenter defaultCenter] postNotificationName:ZZRadioNotification(str) object:nil userInfo:@{
+            @"address":[NSString stringWithFormat:@"%p",self]
+        }];
+    }
+    
+    
+    for (UIView *view in self.subviews) {
+        if ([view respondsToSelector:@selector(selected)]) {
+            if ([view isKindOfClass:NSClassFromString(@"ZZOption")] || [view isKindOfClass:NSClassFromString(@"ZZCheckBox")]) {
+                if (![[view valueForKey:@"selected"] boolValue]) {
+                    continue;
+                }
+                self.selectStr = [[view valueForKey:@"title"] valueForKey:@"text"];
+                if (self.selectedBlock) {
+                    self.selectedBlock(self.selectStr);
+                    //退出循环
+                    return;
+                }
+            }
+        }
+    }
+}
+
+-(void)receiveRadio:(NSNotification *)noti{
+    //是自己发出的通知就return
+    if ([noti.userInfo[@"address"] isEqualToString:[NSString stringWithFormat:@"%p",self]]) {
+        return;
+    }
+    
+    if (_itemArr.count == 0) {
+        for (UIView *view in self.subviews) {
+           if ([view respondsToSelector:@selector(setSelected:)]){
+               [_itemArr addObject:view];
+           }
+        }
+    }
+    
+    for (ZZCheckBox *box in _itemArr) {
+        box.selected = false;
+        self.selectStr = nil;
+    }
+}
+
+-(void)dealloc{
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+@end

+ 19 - 0
ZZUIKit/Classes/ZZSelect/ZZSelect.h

@@ -0,0 +1,19 @@
+//
+//  ZZSelect.h
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/9.
+//
+
+#import <FlexLib/FlexLib.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// 包裹ZZCheckBox
+@interface ZZSelect : FlexCustomBaseView
+/// 选中的标签数组
+@property(nonatomic,strong) NSMutableArray *selectArr;
+@property(nonatomic,copy) void (^selectBlock)(NSMutableArray *arr);
+@end
+
+NS_ASSUME_NONNULL_END

+ 42 - 0
ZZUIKit/Classes/ZZSelect/ZZSelect.m

@@ -0,0 +1,42 @@
+//
+//  ZZSelect.m
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/9.
+//
+
+#import "ZZSelect.h"
+
+@implementation ZZSelect
+
+- (void)onInit{
+    
+}
+
+
+/// ZZOption点击会调用这个方法
+-(void)onClick{
+    //遍历子视图取出选中的option
+    _selectArr = [NSMutableArray array];
+    for (UIView *view in self.subviews) {
+        if ([view respondsToSelector:@selector(selected)]) {
+            if ([view isKindOfClass:NSClassFromString(@"ZZOption")] || [view isKindOfClass:NSClassFromString(@"ZZCheckBox")]) {
+                if (![[view valueForKey:@"selected"] boolValue]) {
+                    continue;
+                }
+                NSString *str = [[view valueForKey:@"title"] valueForKey:@"text"];
+                [_selectArr addObject:str];
+            }
+        }
+    }
+    NSLog(@"_selectArr:");
+    for (NSString *str in _selectArr) {
+        NSLog(@"%@",str);
+    }
+    if (_selectBlock) {
+         
+        _selectBlock(self.selectArr);
+    }
+}
+
+@end

+ 24 - 0
ZZUIKit/Classes/ZZSwitchWidget/ZZSwitchWidget.h

@@ -0,0 +1,24 @@
+//
+//  ZZSwitchWidget.h
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/3.
+//
+
+#import <FlexLib/FlexLib.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ZZSwitchWidget : FlexCustomBaseView
+/// 文字
+@property(nonatomic,strong) UILabel *title;
+
+/// 开关
+@property(nonatomic,strong) UISwitch *toggle;
+
+/// 开关
+@property(nonatomic,strong) UILabel *toggleLabel;
+@property(nonatomic,strong) UILabel *toggleOffLabel;
+@end
+
+NS_ASSUME_NONNULL_END

+ 59 - 0
ZZUIKit/Classes/ZZSwitchWidget/ZZSwitchWidget.m

@@ -0,0 +1,59 @@
+//
+//  ZZSwitchWidget.m
+//  ZZUIKit
+//
+//  Created by Max on 2021/3/3.
+//
+
+#import "ZZSwitchWidget.h"
+#import <ZZUIKit/ZZColor.h>
+
+@implementation ZZSwitchWidget
+
+-(NSBundle *)bundleForRes{
+    NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+    NSURL *bundleURL = [bundle URLForResource:@"ZZUIKit" withExtension:@"bundle"];
+    NSBundle *resourceBundle = [NSBundle bundleWithURL: bundleURL];
+    return resourceBundle;
+}
+
+-(void)onInit{
+    self.toggle.backgroundColor = [UIColor lightGrayColor];
+    self.toggle.layer.cornerRadius = 15.5;
+    self.toggle.layer.masksToBounds = true;
+}
+
+FLEXSET(toggleBgColor){
+    UIColor* clr = colorFromString(sValue,owner) ;
+    self.toggle.backgroundColor = clr;
+}
+
+FLEXSET(on){
+    self.toggle.on = String2BOOL(sValue);
+}
+
+FLEXSET(onStr){
+    self.toggleLabel.text = sValue;
+}
+
+FLEXSET(offStr){
+    self.toggleOffLabel.text = sValue;
+}
+
+FLEXSET(tintColor){
+    UIColor* clr = colorFromString(sValue,owner) ;
+    self.toggle.onTintColor = clr;
+}
+
+FLEXSET(thumbTintColor){
+    UIColor* clr = colorFromString(sValue,owner) ;
+    self.toggle.thumbTintColor = clr;
+}
+
+FLEXSET(title){
+    self.title.text = sValue;
+}
+
+
+
+@end

+ 1 - 0
ZZUIKit/Classes/ZZTextWidget/ZZTextWidget.h

@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (assign, nonatomic) NSInteger maxLength;//最大长度
 @property (strong, nonatomic) UILabel *placeholderLabel;
 @property (strong, nonatomic) UILabel *wordNumLabel;
+@property (copy, nonatomic) NSString *wordNumFormat;
 
 //文字输入
 @property (copy, nonatomic) void(^didChangeText)(ZZTextWidget *textView);

+ 4 - 3
ZZUIKit/Classes/ZZTextWidget/ZZTextWidget.m

@@ -80,7 +80,8 @@
 {
 
     _maxLength = maxLength;
-    self.wordNumLabel.text = [NSString stringWithFormat:@"0/%ld字", (long)_maxLength];
+    if(!_wordNumFormat) {_wordNumFormat = @"%ld/%ld字";}
+    self.wordNumLabel.text = [NSString stringWithFormat:_wordNumFormat, 0,(long)_maxLength];
 }
 - (void)placeholderTextViewdidChange:(NSNotification *)notificat
 {
@@ -98,7 +99,7 @@
         textView.text = [textView.text substringToIndex:self.maxLength];
     }
     long length = [textView.text length] > _maxLength ? _maxLength : [textView.text length];
-    self.wordNumLabel.text = [NSString stringWithFormat:@"%ld/%ld字", length, (long)_maxLength];
+    self.wordNumLabel.text = [NSString stringWithFormat:_wordNumFormat, length, (long)_maxLength];
     if (self.didChangeText) {
         self.didChangeText(textView);
     }
@@ -116,7 +117,7 @@
     [super setText:text];
     if (text.length > 0) {
         [self.placeholderLabel setHidden:YES];
-        self.wordNumLabel.text = [NSString stringWithFormat:@"%ld/%ld字", (long)[text length], (long)_maxLength];
+        self.wordNumLabel.text = [NSString stringWithFormat:_wordNumFormat, (long)[text length], (long)_maxLength];
         [self refreshFram];
     }
 }