浏览代码

修改全流程UI

zzb 4 年之前
父节点
当前提交
c46c829f1d

+ 2 - 1
Example/Podfile

@@ -2,7 +2,8 @@ use_frameworks!
 
 platform :ios, '9.0'
 
-source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
+#source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
+source 'https://github.com/CocoaPods/Specs.git'
 
 target 'ZZUIKit_Example' do
   pod 'ZZUIKit', :path => '../'

+ 7 - 1
Example/Pods/Local Podspecs/ZZUIKit.podspec.json

@@ -34,7 +34,13 @@
     "ZZUIKit/Classes/ZZDialog/*",
     "ZZUIKit/Classes/ZZTextImgView/*",
     "ZZUIKit/Classes/ZZTextWidget/*",
-    "ZZUIKit/Classes/ZZViewController/*"
+    "ZZUIKit/Classes/ZZViewController/*",
+    "ZZUIKit/Classes/ZZInfoWidget/*",
+    "ZZUIKit/Classes/ZZSwitchWidget/*",
+    "ZZUIKit/Classes/ZZCheckBox/*",
+    "ZZUIKit/Classes/ZZRaido/*",
+    "ZZUIKit/Classes/ZZSelect/*",
+    "ZZUIKit/Classes/ZZOption/*"
   ],
   "resource_bundles": {
     "ZZUIKit": [

+ 1 - 1
ZZUIKit/Classes/Ex/Control/UIControl+ZZEx.m

@@ -42,7 +42,7 @@
 
 
 #pragma mark -- event
-static void *ZZ_eventBlocKey = &ZZ_eventBlocKey;
+static char ZZ_eventBlocKey;
 
 -(void)setZz_eventBlock:(ZZControlEventsBlock)zz_eventBlock{
     objc_setAssociatedObject(self, &ZZ_eventBlocKey, zz_eventBlock, OBJC_ASSOCIATION_COPY);

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

@@ -54,7 +54,8 @@ ZZDialogCancelMarginMake(CGFloat top, CGFloat right)
 /// content的view
 @property(nonatomic,strong) UIView *contentView;
 @property(nonatomic,strong) UIStackView *handleView;
-
+@property(nonatomic,strong) UIView *handleViewWrapper;
+-(void)setSeparateColor:(UIColor *)separateColor;
 
 /// cancelImg cancelBtn 二选一
 @property(nonatomic,strong,nullable) UIImage *cancelImg;

+ 17 - 2
ZZUIKit/Classes/ZZDialog/ZZDialog.m

@@ -15,6 +15,7 @@
 -(instancetype)initWithFrame:(CGRect)frame{
     if (self == [super initWithFrame:frame]) {
         self.backgroundColor = [UIColor whiteColor];
+        [self addSubview:self.handleViewWrapper];
         [self addSubview:self.handleView];
         self.cancelMargin = ZZDialogCancelMarginMake(10, 10);
         self.cancelPosition = ZZDialogCancelPositionTopRight;
@@ -24,7 +25,9 @@
 
 -(void)setHandleDelegate:(id<ZZDialogHandleDelegate>)handleDelegate{
     _handleDelegate = handleDelegate;
-    _handleView.frame = [handleDelegate preferredFrameForHandleInDialog:self];
+    CGRect frame = [handleDelegate preferredFrameForHandleInDialog:self];
+    _handleViewWrapper.frame = CGRectMake(frame.origin.x, frame.origin.y - 0.5, frame.size.width, frame.size.height + 0.5);
+    _handleView.frame = frame;
     NSArray *dicArr = [handleDelegate itemsForHandleInDialog:self];
 //    @weakify(self);
     [dicArr enumerateObjectsUsingBlock:^(NSDictionary *itemDic, NSUInteger idx, BOOL * _Nonnull stop) {
@@ -172,13 +175,25 @@
     return view;
 }
 
+-(UIView *)handleViewWrapper{
+    if(!_handleViewWrapper){
+        _handleViewWrapper = [UIView new];
+        _handleViewWrapper.backgroundColor = [UIColor clearColor];
+    }
+    return _handleViewWrapper;
+}
+
+-(void)setSeparateColor:(UIColor *)separateColor{
+    _handleViewWrapper.backgroundColor = separateColor;
+}
+
 -(UIStackView *)handleView{
     if(!_handleView){
         _handleView = [[UIStackView alloc] init];
         _handleView.axis = UILayoutConstraintAxisHorizontal;
         _handleView.distribution = UIStackViewDistributionFillEqually;
         _handleView.alignment = UIStackViewAlignmentFill;
-        _handleView.spacing = 0.8;
+        _handleView.spacing = 0.5;
     }
     return _handleView;
 }

+ 1 - 1
ZZUIKit/Classes/ZZUIKit.h

@@ -29,6 +29,6 @@
 
 #import "ZZTextWidget.h"
 #import "ZZTextInputWidget.h"
-
+#import "ZZWebviewController.h"
 
 #endif /* ZZUIKit_h */

+ 16 - 0
ZZUIKit/Classes/ZZWebviewController/ZZWebviewController.h

@@ -0,0 +1,16 @@
+//
+//  ZZWebviewController.h
+//  ZZUIKit
+//
+//  Created by Max on 2021/5/14.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ZZWebviewController : UIViewController
+@property(nonatomic,copy) NSString *loadURL;
+@end
+
+NS_ASSUME_NONNULL_END

+ 83 - 0
ZZUIKit/Classes/ZZWebviewController/ZZWebviewController.m

@@ -0,0 +1,83 @@
+//
+//  ZZWebviewController.m
+//  ZZUIKit
+//
+//  Created by Max on 2021/5/14.
+//
+
+#import "ZZWebviewController.h"
+#import <WebKit/WebKit.h>
+#import <ZZUIKit/ZZColor.h>
+#import "ZZFrame.h"
+
+@interface ZZWebviewController ()<WKNavigationDelegate,WKNavigationDelegate>
+@property(nonatomic,strong) WKWebView *webView;
+@end
+
+@implementation ZZWebviewController
+
+-(instancetype)initWithCoder:(NSCoder *)coder{
+    if (self == [super initWithCoder:coder]) {
+        [self commonInit];
+    }
+    return self;
+}
+
+-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
+    if (self == [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
+        [self commonInit];
+    }
+    return  self;
+}
+
+-(void)commonInit{
+    self.webView.backgroundColor = [UIColor whiteColor];
+}
+
+-(void)setLoadURL:(NSString *)loadURL{
+    _loadURL = loadURL;
+//    NSString *urlStr = ZZString(@"http://njmb-h5.hiseemedical.com/#/equipmentList?token=%@&platform=APP",token);
+    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:loadURL]];
+    [_webView loadRequest:request];
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    [self configUI];
+}
+
+-(void)configUI{
+    self.view.backgroundColor = zz_RGBHex(0xffffff);
+    [self.view addSubview:self.webView];
+    if (@available(iOS 11.0, *)) {
+        self.webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
+    }else{
+        self.automaticallyAdjustsScrollViewInsets = false;
+    }
+}
+
+-(void)viewDidLayoutSubviews{
+    [super viewDidLayoutSubviews];
+    self.webView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
+}
+
+-(WKWebView *)webView{
+    if(!_webView){
+        _webView = [[WKWebView alloc] init];
+        _webView.UIDelegate = self;
+        _webView.navigationDelegate = self;
+        _webView.scrollView.contentInset = UIEdgeInsetsMake(self.navigationController.navigationBarHidden || !self.navigationController.navigationBar.isTranslucent ? 0 : NAV_STATUS_BAR_H(), 0, BOTTOM_PADDING(), 0);
+    }
+    return _webView;
+}
+
+#pragma mark - WKNavigationDelegate
+-(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
+    
+}
+
+- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error {
+ 
+}
+@end