Parcourir la source

修改了ZZRadio ZZCheckBox ZZOption title->titleLab

zzb il y a 4 ans
Parent
commit
af73c430e6

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

@@ -2,5 +2,5 @@
 <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:选项"/>
+    <UILabel name="titleLab" layout="flex:1," attr="font:PingFangSC-Regular|15,color:#333333,text:选项"/>
 </UIView>

+ 1 - 1
ZZUIKit/Classes/ZZCheckBox/ZZCheckBox.h

@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
 /// 图片控件;无图片的时候隐藏
 @property(nonatomic,strong) UIImageView *imgV;
 /// 文本
-@property(nonatomic,strong) UILabel *title;
+@property(nonatomic,strong) UILabel *titleLab;
 /// xml创建的View
 @property(nonatomic,strong) UIView *wrapper;
 

+ 2 - 2
ZZUIKit/Classes/ZZCheckBox/ZZCheckBox.m

@@ -25,7 +25,7 @@
     _imgV.hidden = true;
     _selected = false;
     _reverse = true;
-    _title.textAlignment = NSTextAlignmentLeft;
+    _titleLab.textAlignment = NSTextAlignmentLeft;
     @weakify(self);
     self.zz_tapAction(^(UIView *view){
         @strongify(self);
@@ -77,6 +77,6 @@ FLEXSET(unselImg){
 }
 
 FLEXSET(title){
-    self.title.text = sValue;
+    self.titleLab.text = sValue;
 }
 @end

+ 1 - 1
ZZUIKit/Classes/ZZOption/ZZOption.h

@@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property(nonatomic,copy) void(^clickEvent)(ZZOption *box);
 
 /// 文本
-@property(nonatomic,strong) UILabel *title;
+@property(nonatomic,strong) UILabel *titleLab;
 #pragma mark -- 无图片的属性
 /// 选中的背景色
 @property(nonatomic,copy) NSString *selBgc;

+ 16 - 10
ZZUIKit/Classes/ZZOption/ZZOption.m

@@ -8,6 +8,10 @@
 #import "ZZOption.h"
 #import <ZZUIKit/ZZUIKitEx.h>
 
+@interface ZZOption()
+@property(nonatomic,copy) NSString *title;
+@end
+
 @implementation ZZOption
 
 //-(NSBundle *)bundleForRes{
@@ -17,14 +21,15 @@
 //    return resourceBundle;
 //}
 
--(UILabel *)title{
-    if(!_title){
-        _title = [[UILabel alloc] init];
-        _title.textAlignment = NSTextAlignmentCenter;
-        [_title setLayoutAttr:@"flex" Value:@"1"];
-        [_title enableFlexLayout:true];
+-(UILabel *)titleLab{
+    if(!_titleLab){
+        _titleLab = [[UILabel alloc] init];
+        _titleLab.text = _title;
+        _titleLab.textAlignment = NSTextAlignmentCenter;
+        [_titleLab setLayoutAttr:@"flex" Value:@"1"];
+        [_titleLab enableFlexLayout:true];
     }
-    return _title;
+    return _titleLab;
 }
 
 -(void)onInit{
@@ -32,7 +37,7 @@
     _unselTextColor = @"#333333";
     _reverse = true;
     UIView *frameView = [self valueForKey:@"frameView"];
-    [frameView addSubview:self.title];
+    [frameView addSubview:self.titleLab];
     self.selected = false;
     @weakify(self);
     self.zz_tapAction(^(UIView *view){
@@ -70,7 +75,7 @@
     if (_selBgc && _unselBgc) {
         self.backgroundColor = _selected ?colorFromString(_selBgc, nil):colorFromString(_unselBgc, nil);
     }
-    self.title.textColor = _selected ? colorFromString(_selTextColor, nil) : colorFromString(_unselTextColor, nil);
+    self.titleLab.textColor = _selected ? colorFromString(_selTextColor, nil) : colorFromString(_unselTextColor, nil);
 }
 
 FLEXSET(reverse){
@@ -112,6 +117,7 @@ FLEXSET(unselBorderColor){
 }
 
 FLEXSET(title){
-    self.title.text = sValue;
+    self.title = sValue;
+    self.titleLab.text = sValue;
 }
 @end

+ 1 - 1
ZZUIKit/Classes/ZZRaido/ZZRadio.m

@@ -45,7 +45,7 @@ FLEXSET(label){
                 if (![[view valueForKey:@"selected"] boolValue]) {
                     continue;
                 }
-                self.selectStr = [[view valueForKey:@"title"] valueForKey:@"text"];
+                self.selectStr = [[view valueForKey:@"titleLab"] valueForKey:@"text"];
                 if (self.selectedBlock) {
                     self.selectedBlock(self.selectStr);
                     //退出循环

+ 1 - 1
ZZUIKit/Classes/ZZSelect/ZZSelect.m

@@ -24,7 +24,7 @@
                 if (![[view valueForKey:@"selected"] boolValue]) {
                     continue;
                 }
-                NSString *str = [[view valueForKey:@"title"] valueForKey:@"text"];
+                NSString *str = [[view valueForKey:@"titleLab"] valueForKey:@"text"];
                 [_selectArr addObject:str];
             }
         }