Commit 0a580f67cdfdc9f9ebb064d23e2ef494a4e5b84c

Authored by yinqiaojuan
1 parent 34b63968

0.0.6

Too many changes to show.

To preserve performance only 17 of 1365 files are displayed.

CNLiveDisease.podspec
1 1  
2 2 Pod::Spec.new do |s|
3 3 s.name = 'CNLiveDisease'
4   - s.version = '0.0.5'
  4 + s.version = '0.0.6'
5 5 s.summary = '智慧农业部分组件化'
6 6  
7   -# This description is used to generate tags and improve search results.
8   -# * Think: What does it do? Why did you write it? What is the focus?
9   -# * Try to keep it short, snappy and to the point.
10   -# * Write the description between the DESC delimiters below.
11   -# * Finally, don't worry about the indent, CocoaPods strips it!
12   -
13 7 s.description = <<-DESC
14 8 TODO: Add long description of the pod here.
15 9 DESC
... ... @@ -39,4 +33,5 @@ TODO: Add long description of the pod here.
39 33 s.dependency 'CNLiveAVCamera'
40 34 # s.dependency 'CNLiveUploadManager'
41 35 # s.ios.vendored_library = 'CNLiveUploadManager'
  36 + s.dependency 'FLAnimatedImage'
42 37 end
... ...
CNLiveDisease/Classes/Controller/CNLiveDiseaseDescController.h
... ... @@ -11,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
11 11  
12 12 @interface CNLiveDiseaseDescController : QMUICommonViewController
13 13  
  14 +@property (strong, nonatomic) NSDictionary * dataDict;
14 15 @end
15 16  
16 17 NS_ASSUME_NONNULL_END
... ...
CNLiveDisease/Classes/Controller/CNLiveDiseaseDescController.m
... ... @@ -6,7 +6,281 @@
6 6 //
7 7  
8 8 #import "CNLiveDiseaseDescController.h"
  9 +#import <WebKit/WebKit.h>
  10 +#import <FLAnimatedImage/FLAnimatedImageView.h>
  11 +#import <CNLiveBaseKit/CNLiveBaseKit.h>
  12 +#import <CNLiveCommonCategory/CNLiveCommonCategory.h>
  13 +#define MJWeakSelf __weak typeof(self) weakSelf = self;
  14 +@interface CNLiveDiseaseDescController ()<WKNavigationDelegate,WKUIDelegate>
  15 +{
  16 + WKUserContentController *userContentController;
  17 +}
  18 +
  19 +@property(nonatomic, strong) WKWebView *wkwebView;
  20 +@property (strong, nonatomic) FLAnimatedImageView * tempImageView;
  21 +@property (strong, nonatomic) NSMutableArray * imageMutArr;
  22 +@property (strong, nonatomic) NSMutableArray * imageArr;
  23 +@property (strong, nonatomic) UIProgressView *progressView;//这个是加载页面的进度条
  24 +@end
9 25  
10 26 @implementation CNLiveDiseaseDescController
11 27  
  28 +-(void)viewWillAppear:(BOOL)animated {
  29 + [super viewWillAppear:animated];
  30 + [self initProgressView];
  31 +}
  32 +-(void)viewDidAppear:(BOOL)animated {
  33 + [super viewDidAppear:animated];
  34 + [self.progressView removeFromSuperview];
  35 +}
  36 +-(void)viewDidLoad {
  37 + [super viewDidLoad];
  38 + self.title = @"诊断结果";
  39 + [self initWKWebView];
  40 +}
  41 +-(void)setDataDict:(NSDictionary *)dataDict
  42 +{
  43 + _dataDict = dataDict;
  44 +}
  45 +#pragma mark 初始化webview
  46 +-(void)initWKWebView
  47 +{
  48 +
  49 + WKWebViewConfiguration * configuration = [[WKWebViewConfiguration alloc]init];//先实例化配置类 以前UIWebView的属性有的放到了这里
  50 + //注册供js调用的方法
  51 + userContentController =[[WKUserContentController alloc]init];
  52 +
  53 + configuration.userContentController = userContentController;
  54 + configuration.preferences.javaScriptEnabled = YES;//打开js交互
  55 + _wkwebView = [[WKWebView alloc] initWithFrame:CGRectMake(0, kNavigationBarHeight, KScreenWidth, KScreenHeight-kNavigationBarHeight) configuration:configuration];
  56 + [self.view addSubview:_wkwebView];
  57 + _wkwebView.backgroundColor = [UIColor whiteColor];
  58 + _wkwebView.allowsBackForwardNavigationGestures =YES;//打开网页间的 滑动返回
  59 + _wkwebView.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
  60 + if (@available(iOS 9.0, *)) {
  61 + _wkwebView.allowsLinkPreview = NO;
  62 + }
  63 + _wkwebView.UIDelegate = self;
  64 + _wkwebView.navigationDelegate = self;
  65 + [_wkwebView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil];//注册observer 拿到加载进度
  66 +
  67 + MJWeakSelf
  68 + NSDictionary * tempDict = [_dataDict objectForKey:@"images"];
  69 + __block NSMutableString * imageStr = [[NSMutableString alloc] init];
  70 + if (tempDict) {
  71 + [tempDict enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
  72 + [weakSelf.imageMutArr addObject:[obj objectForKey:@"image"]];
  73 + [weakSelf.imageArr addObject:weakSelf.tempImageView];
  74 + [imageStr appendFormat:[weakSelf loadImageDocumentHTML],[obj objectForKey:@"image"],[obj objectForKey:@"caption"]];
  75 + }];
  76 + }else{
  77 + [imageStr appendString:@"<br />"];
  78 + }
  79 +
  80 +
  81 + NSMutableString * descStr = [[NSMutableString alloc] init];
  82 + // CNLiveStringIsEmpty([_dataDict objectForKey:@"symptom"])
  83 + if (![self isEmptyString:[_dataDict objectForKey:@"symptom"]]) {
  84 + [descStr appendFormat:[self loadDescDocumentHTML],@"症状",[_dataDict objectForKey:@"symptom"]];
  85 + }else{
  86 + [descStr appendString:@"<br />"];
  87 + }
  88 + // CNLiveStringIsEmpty([_dataDict objectForKey:@"pattern"])
  89 +
  90 + if (![self isEmptyString:[_dataDict objectForKey:@"pattern"]]) {
  91 + [descStr appendFormat:[self loadDescDocumentHTML],@"发病规律",[_dataDict objectForKey:@"pattern"]];
  92 + }else{
  93 + [descStr appendString:@"<br />"];
  94 + }
  95 + //CNLiveStringIsEmpty([_dataDict objectForKey:@"method"])
  96 + if (![self isEmptyString:[_dataDict objectForKey:@"method"]]) {
  97 + [descStr appendFormat:[self loadDescDocumentHTML],@"防治方法",[_dataDict objectForKey:@"method"]];
  98 + }else{
  99 + [descStr appendString:@"<br />"];
  100 + }
  101 +
  102 + NSString * nameStr = [NSString stringWithFormat:[self loadNameDocumentHTML],[_dataDict objectForKey:@"name"],[_dataDict objectForKey:@"introduction"]];
  103 +
  104 + NSString * htmls = [NSString stringWithFormat:[self loadDocumentHTML],nameStr,imageStr,descStr];
  105 +
  106 + [_wkwebView loadHTMLString:htmls baseURL:nil];
  107 +}
  108 +
  109 +-(NSString *)loadDocumentHTML
  110 +{
  111 + return @"<!DOCTYPE html>\n"
  112 + "<html> \n"
  113 + "<head> \n"
  114 + "<meta charset=\"utf-8\" name=\"viewport\" content=\"initial-scale=1.0, maximum-scale=1.0, user-scalable=no\"> \n"
  115 + "<style type=\"text/css\"> \n"
  116 + "body {font-weight: bold;line-height: 0 auto-pos;text-align: center;} \n"
  117 + "h2 {text-align: center;font-size: 30px;height: 0 auto;margin-bottom: 5px;} \n"
  118 + ".nameDesc {margin-left: 10px;margin-right: 10px;font-size: 15px;text-align: left;} \n"
  119 + ".textDesc {margin-left: 10px;margin-right: 10px;font-size: 12px;text-align: left;} \n"
  120 + "img {margin-bottom: 5px;margin-top: 10px;margin-left: 30px;margin-right: 30px;height: 200px;} \n"
  121 + ".imageDesc {color: red;font-size: 14px;text-align: center;margin-top: 5px;margin-bottom: 30px;} \n"
  122 + "</style> \n"
  123 + "</head> \n"
  124 + "<body> \n"
  125 + "%@"
  126 + "%@"
  127 + "%@"
  128 + "</body> \n"
  129 + "</html> \n";
  130 +}
  131 +-(NSString *)loadNameDocumentHTML
  132 +{
  133 + return @"<div class=\"nameDiv\">\n"
  134 + "<h2>%@</h2> \n"
  135 + "<p class=\"nameDesc\">%@</p> \n"
  136 + "</div> \n";
  137 +}
  138 +-(NSString *)loadImageDocumentHTML
  139 +{
  140 + return @"<div class=\"imageDiv\"> \n"
  141 + "<img src=\"%@\" /> \n"
  142 + "<br /> \n"
  143 + "<p class=\"imageDesc\">%@</p> \n"
  144 + "</div> \n";
  145 +}
  146 +-(NSString *)loadDescDocumentHTML
  147 +{
  148 + return @"<div class=\"nameDiv\"> \n"
  149 + "<h2>%@</h2> \n"
  150 + "<p class=\"textDesc\">%@</p> \n"
  151 + "</div> \n";
  152 +}
  153 +#pragma mark --这个就是设置的上面的那个加载的进度
  154 +-(void)initProgressView
  155 +{
  156 + CGFloat progressBarHeight = 3.0f;
  157 + CGRect navigaitonBarBounds = self.navigationController.navigationBar.bounds;
  158 + // CGRect barFrame = CGRectMake(0, navigaitonBarBounds.size.height - progressBarHeight-0.5, navigaitonBarBounds.size.width, progressBarHeight);
  159 + CGRect barFrame = CGRectMake(0, navigaitonBarBounds.size.height, navigaitonBarBounds.size.width, progressBarHeight);
  160 + if (!_progressView || !_progressView.superview) {
  161 + _progressView =[[UIProgressView alloc]initWithFrame:barFrame];
  162 + _progressView.tintColor = UIColorMake(0, 194, 0);
  163 + _progressView.trackTintColor = [UIColor clearColor];
  164 +
  165 + [self.navigationController.navigationBar addSubview:self.progressView];
  166 + }
  167 +}
  168 +//检测进度条,显示完成之后,进度条就隐藏了
  169 +-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context{
  170 +
  171 + if (object == self.wkwebView && [keyPath isEqualToString:@"estimatedProgress"]) {
  172 + CGFloat newprogress = [[change objectForKey:NSKeyValueChangeNewKey] doubleValue];
  173 + if (newprogress == 1) {
  174 + self.progressView.hidden = YES;
  175 + [self.progressView setProgress:0 animated:NO];
  176 + }else {
  177 + self.progressView.hidden = NO;
  178 + [self.progressView setProgress:newprogress animated:YES];
  179 + }
  180 + }
  181 +}
  182 +#pragma mark - ——————— WKNavigationDelegate ————————
  183 +// 页面开始加载时调用
  184 +-(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
  185 + [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
  186 +}
  187 +// 当内容开始返回时调用
  188 +-(void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation{
  189 +
  190 +}
  191 +// 页面加载完成之后调用
  192 +-(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
  193 + [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
  194 + [webView evaluateJavaScript: @"function assignImageClickAction(){var imgs=document.getElementsByTagName('img');var length=imgs.length;for(var i=0; i < length;i++){img=imgs[i];if(\"ad\" ==img.getAttribute(\"flag\")){var parent = this.parentNode;if(parent.nodeName.toLowerCase() != \"a\")return;}img.onclick=function(){window.location.href='image-preview:'+this.src}}}"
  195 + completionHandler: ^(id object, NSError *error) {}];
  196 +
  197 + [webView evaluateJavaScript: @"assignImageClickAction();"
  198 + completionHandler: ^(id object, NSError *error) {}];
  199 +}
  200 +- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler{
  201 +
  202 + MJWeakSelf
  203 + if ([navigationAction.request.URL.scheme isEqualToString: @"image-preview"]) {
  204 +
  205 + if (self.imageMutArr.count != 0) {
  206 +
  207 + NSString* imageUrlStr = [navigationAction.request.URL.absoluteString
  208 + substringFromIndex:14];
  209 +
  210 + NSUInteger index = [self.imageMutArr indexOfObject:imageUrlStr];
  211 +
  212 +// [CNCustomImageTool sharedCNCustomImageTool].formVC = weakSelf;
  213 +// [[CNCustomImageTool sharedCNCustomImageTool] initWithImageArray:weakSelf.imageArr SourceUrl:self.imageMutArr SelectImageView:weakSelf.tempImageView isCollect:NO CurrentIndex:index FromVC:weakSelf];
  214 + }
  215 + }
  216 + decisionHandler(WKNavigationActionPolicyAllow);
  217 +}
  218 +// 页面加载失败时调用
  219 +-(void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation{
  220 +
  221 +}
  222 +-(NSMutableArray *)imageArr
  223 +{
  224 + if (!_imageArr) {
  225 + _imageArr = [[NSMutableArray alloc] init];
  226 + }
  227 + return _imageArr;
  228 +}
  229 +-(NSMutableArray *)imageMutArr
  230 +{
  231 + if (!_imageMutArr) {
  232 + _imageMutArr = [[NSMutableArray alloc] init];
  233 + }
  234 + return _imageMutArr;
  235 +}
  236 +-(FLAnimatedImageView *)tempImageView
  237 +{
  238 + if (!_tempImageView) {
  239 + _tempImageView = [[FLAnimatedImageView alloc] initWithFrame: CGRectMake(KScreenWidth/2, KScreenHeight/2, 0, 0)];
  240 + _tempImageView.image = [UIImage imageWithColor:kBlackColor];
  241 + }
  242 + return _tempImageView;
  243 +}
  244 +-(void)dealloc{
  245 + [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
  246 + [self.wkwebView removeObserver:self forKeyPath:@"estimatedProgress"];
  247 + self.wkwebView.UIDelegate = nil;
  248 + self.wkwebView.navigationDelegate = nil;
  249 + [self clearWebCache];
  250 +}
  251 +- (void)clearWebCache {
  252 + if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
  253 +
  254 + NSSet *websiteDataTypes = [NSSet setWithArray:@[
  255 + WKWebsiteDataTypeDiskCache,
  256 + //WKWebsiteDataTypeOfflineWebApplicationCache,
  257 + //WKWebsiteDataTypeMemoryCache,
  258 + //WKWebsiteDataTypeLocalStorage,
  259 + //WKWebsiteDataTypeCookies,
  260 + //WKWebsiteDataTypeSessionStorage,
  261 + //WKWebsiteDataTypeIndexedDBDatabases,
  262 + //WKWebsiteDataTypeWebSQLDatabases
  263 + ]];
  264 + NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
  265 + [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{
  266 + }];
  267 + } else {
  268 + NSString *libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
  269 +
  270 + NSString *cookiesFolderPath = [libraryPath stringByAppendingString:@"/Cookies"];
  271 +
  272 + NSError *errors;
  273 +
  274 + [[NSFileManager defaultManager] removeItemAtPath:cookiesFolderPath error:&errors];
  275 + }
  276 +}
  277 +
  278 +//判断是否为空字符串
  279 +- (BOOL)isEmptyString:(NSString *)string
  280 +{
  281 + if (!string || ![string isKindOfClass:[NSString class]] || string.length == 0 || [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length == 0) {
  282 + return YES;
  283 + }
  284 + return NO;
  285 +}
12 286 @end
... ...
CNLiveDisease/Classes/Controller/CNLiveDiseaseFailedController.h
... ... @@ -10,7 +10,8 @@
10 10 NS_ASSUME_NONNULL_BEGIN
11 11  
12 12 @interface CNLiveDiseaseFailedController : QMUICommonViewController
13   -
  13 +@property (nonatomic, copy) NSString *name;
  14 +@property (nonatomic, copy) NSString *introduction;
14 15 @end
15 16  
16 17 NS_ASSUME_NONNULL_END
... ...
CNLiveDisease/Classes/Controller/CNLiveDiseaseFailedController.m
... ... @@ -6,7 +6,100 @@
6 6 //
7 7  
8 8 #import "CNLiveDiseaseFailedController.h"
  9 +#import <Masonry/Masonry.h>
  10 +#import <CNLiveBaseKit/CNLiveBaseKit.h>
  11 +#import "CNLiveGetImage.h"
  12 +#define MJWeakSelf __weak typeof(self) weakSelf = self;
  13 +@interface CNLiveDiseaseFailedController ()
  14 +@property (nonatomic, strong) UIImageView * showImageV;
  15 +@property (nonatomic, strong) UILabel *nameLabel;
  16 +@property (nonatomic, strong) UILabel *introductionL;
  17 +@property (nonatomic, strong) UIButton *retryBtn;
  18 +@end
9 19  
10 20 @implementation CNLiveDiseaseFailedController
11   -
  21 +-(void)viewDidLoad {
  22 + [super viewDidLoad];
  23 + self.title = @"识别错误";
  24 + [self setupViews];
  25 + self.nameLabel.text = self.name;
  26 + self.introductionL.text = self.introduction;
  27 +}
  28 +-(void)setupViews {
  29 + [self.view addSubview:self.showImageV];
  30 + [self.view addSubview:self.nameLabel];
  31 + [self.view addSubview:self.introductionL];
  32 + [self.view addSubview:self.retryBtn];
  33 + [self setUpLayout];
  34 +}
  35 +-(void)setUpLayout {
  36 + MJWeakSelf;
  37 + [_showImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  38 + make.top.mas_equalTo(weakSelf.view).offset(kNavigationBarHeight + 120);
  39 + make.centerX.mas_equalTo(weakSelf.view.mas_centerX);
  40 + make.height.with.mas_equalTo(80);
  41 + }];
  42 + [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  43 + make.top.mas_equalTo(weakSelf.showImageV.mas_bottom).offset(35);
  44 + make.left.mas_equalTo(weakSelf.view.mas_left).offset(80);
  45 + make.right.mas_equalTo(weakSelf.view.mas_right).offset(-80);
  46 + make.height.mas_equalTo(16);
  47 + }];
  48 + [_introductionL mas_makeConstraints:^(MASConstraintMaker *make) {
  49 + make.top.mas_equalTo(weakSelf.nameLabel.mas_bottom).offset(14);
  50 + make.left.mas_equalTo(weakSelf.view.mas_left).offset(58);
  51 + make.right.mas_equalTo(weakSelf.view.mas_right).offset(-58);
  52 + }];
  53 + [_retryBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  54 + make.top.mas_equalTo(weakSelf.introductionL.mas_bottom).offset(50);
  55 + make.centerX.mas_equalTo(weakSelf.view.mas_centerX);
  56 + make.width.mas_equalTo(132);
  57 + make.height.mas_equalTo(45);
  58 + }];
  59 +}
  60 +-(void)retryBtnClick {
  61 +// [[AppDelegate sharedAppDelegate]popViewControllerWithoutAnimation];
  62 + [self dismissViewControllerAnimated:YES completion:nil];
  63 +}
  64 +-(UIImageView *)showImageV{
  65 + if (!_showImageV) {
  66 + _showImageV = [[UIImageView alloc]init];
  67 + _showImageV.contentMode = UIViewContentModeScaleAspectFit;
  68 +// _showImageV.image = [UIImage imageNamed:@"result_icon_fail"];
  69 + _showImageV.image = [CNLiveGetImage getImageName:[NSString stringWithFormat:@"result_icon_fail"]];
  70 + }
  71 + return _showImageV;
  72 +}
  73 +-(UILabel *)nameLabel {
  74 + if (!_nameLabel) {
  75 + _nameLabel = [[UILabel alloc]init];
  76 + _nameLabel.font = UIFontCNMake(17.0f);
  77 + _nameLabel.textColor = RGBA(102, 102, 102, 1);
  78 + _nameLabel.textAlignment = NSTextAlignmentCenter;
  79 + }
  80 + return _nameLabel;
  81 +}
  82 +-(UILabel *)introductionL {
  83 + if (!_introductionL) {
  84 + _introductionL = [[UILabel alloc]init];
  85 + _introductionL.font = UIFontCNMake(13);
  86 + _introductionL.textColor = RGBA(153, 153, 153, 1);
  87 + _introductionL.textAlignment = NSTextAlignmentCenter;
  88 + _introductionL.numberOfLines = 0;
  89 + }
  90 + return _introductionL;
  91 +}
  92 +-(UIButton *)retryBtn {
  93 + if (!_retryBtn) {
  94 + _retryBtn = [[UIButton alloc]init];
  95 + [_retryBtn setBackgroundColor:RGBA(35, 212, 20, 1)];
  96 + _retryBtn.layer.cornerRadius = 22.5 ;
  97 + _retryBtn.titleLabel.textColor = RGBA(255, 255, 255, 1);
  98 + [_retryBtn setTitle:@"再试一次" forState:UIControlStateNormal];
  99 + _retryBtn.titleLabel.font = [UIFont systemFontOfSize:15.0f];
  100 + [_retryBtn addTarget:self action:@selector(retryBtnClick) forControlEvents:UIControlEventTouchUpInside];
  101 +
  102 + }
  103 + return _retryBtn;
  104 +}
12 105 @end
... ...
CNLiveDisease/Classes/Controller/CNLiveFriutViewController.m
... ... @@ -10,6 +10,8 @@
10 10 #import "CNDiseaseType.h"
11 11 #import <CNLiveBaseKit/CNLiveBaseKit.h>
12 12 #import <QMUIKit/QMUIKit.h>
  13 +#import "CNLiveSelectedViewController.h"
  14 +#import "CNLiveGetImage.h"
13 15 static NSString *cellID = @"Cell";
14 16  
15 17 @interface CNLiveFriutViewController ()<UICollectionViewDataSource,UICollectionViewDelegate>
... ... @@ -23,6 +25,7 @@ static NSString *cellID = @&quot;Cell&quot;;
23 25 }
24 26  
25 27 -(void)setIndex:(NSInteger)index {
  28 +
26 29 self.isAppReview = YES;
27 30 if (index == 0) {
28 31 [self setUpCollectionView];
... ... @@ -77,10 +80,10 @@ static NSString *cellID = @&quot;Cell&quot;;
77 80 if (cell ==nil) {
78 81 cell = [[CNDiseaseViewCell alloc]init];
79 82 }
80   - // cell.backgroundColor = [UIColor cyanColor];
  83 +// cell.backgroundColor = [UIColor cyanColor];
81 84 // cell.showImageV.image = [UIImage imageNamed:self.imageArray[indexPath.row]];
82   - cell.showImageV.image = [self getImageName:self.imageArray[indexPath.row]];
83   -
  85 + cell.showImageV.image = [CNLiveGetImage getImageName:self.imageArray[indexPath.row]];
  86 + NSLog(@"打印这个图片%@",self.imageArray);
84 87 cell.titleLabel.text = self.titleArray[indexPath.row];
85 88 return cell;
86 89 }
... ... @@ -92,10 +95,12 @@ static NSString *cellID = @&quot;Cell&quot;;
92 95 [QMUITips showInfo:@"功能开发中..." inView:self.view hideAfterDelay:1.5f];
93 96 return;
94 97 }
95   -// CNSelectedViewController *selectVc = [[CNSelectedViewController alloc]init];
96   -// selectVc.titleName = self.titleArray[indexPath.row];
97   -// selectVc.imageName = self.imageArray[indexPath.row];
98   -// [[AppDelegate sharedAppDelegate] pushViewController:selectVc withBackTitle:@""];
  98 + CNLiveSelectedViewController *selectVc = [[CNLiveSelectedViewController alloc]init];
  99 + selectVc.titleName = self.titleArray[indexPath.row];
  100 + selectVc.imageName = self.imageArray[indexPath.row];
  101 + selectVc.view.backgroundColor = [UIColor whiteColor];
  102 + [self presentViewController:selectVc animated:YES completion:nil];
  103 +// [self.navigationController pushViewController:selectVc animated:YES];
99 104 }
100 105  
101 106 -(void)setCNNoDataEmptyView {
... ... @@ -103,12 +108,6 @@ static NSString *cellID = @&quot;Cell&quot;;
103 108 [self.emptyView setTextLabelTextColor:UIColorMake(102, 102, 102)];
104 109 self.emptyView.imageViewInsets = UIEdgeInsetsMake(0, 0, 36, 0);
105 110 }
106   -- (UIImage *)getImageName:(NSString *)imageName{
107   - NSBundle *bundle = [NSBundle bundleForClass:[self class]];
108   - NSURL *url = [bundle URLForResource:@"CNLiveDisease" withExtension:@"bundle"];
109   - NSBundle *targetBundle = [NSBundle bundleWithURL:url];
110   - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];
111   - return image;
112   -
113   -}
  111 +
  112 +
114 113 @end
... ...
CNLiveDisease/Classes/Controller/CNLiveSelectedViewController.m
... ... @@ -15,6 +15,7 @@
15 15 #import <Masonry/Masonry.h>
16 16 #import <CNLiveBaseKit/CNLiveBaseKit.h>
17 17 #import <CNLiveImagePickerController/CNImagePickerManager.h>
  18 +#import "CNLiveGetImage.h"
18 19 #define MJWeakSelf __weak typeof(self) weakSelf = self;
19 20 @interface CNLiveSelectedViewController () <TZImagePickerControllerDelegate>
20 21 @property (nonatomic, strong) UIImageView *selectImageV;
... ... @@ -150,6 +151,8 @@
150 151 // }];
151 152 }
152 153  
  154 +
  155 +
153 156 -(void)setUpLayout {
154 157 MJWeakSelf;
155 158 [_backImageV mas_makeConstraints:^(MASConstraintMaker *make) {
... ... @@ -178,7 +181,8 @@
178 181 -(UIButton *)photoBtn {
179 182 if (!_photoBtn) {
180 183 _photoBtn = [UIButton buttonWithType:UIButtonTypeCustom];
181   - [_photoBtn setImage:[UIImage imageNamed:@"farming_release"] forState:UIControlStateNormal];
  184 +// [_photoBtn setImage:[UIImage imageNamed:@"farming_release"] forState:UIControlStateNormal];
  185 + [_photoBtn setImage:[CNLiveGetImage getImageName:[NSString stringWithFormat:@"farming_release"]] forState:UIControlStateNormal];
182 186 [_photoBtn addTarget:self action:@selector(photoBtnClick) forControlEvents:UIControlEventTouchUpInside];
183 187 }
184 188 return _photoBtn;
... ... @@ -186,11 +190,13 @@
186 190 -(UIImageView *)backImageV {
187 191 if (!_backImageV) {
188 192 _backImageV = [[UIImageView alloc]init];
189   - _backImageV.image = [UIImage imageNamed:@"farming_bg"];
  193 +// _backImageV.image = [UIImage imageNamed:@"farming_bg"];
  194 + _backImageV.image = [CNLiveGetImage getImageName:[NSString stringWithFormat:@"farming_bg"]];
190 195 _backImageV.contentMode = UIViewContentModeScaleAspectFill;
191 196 _backImageV.clipsToBounds = YES;
192 197 _backImageV.userInteractionEnabled = YES;
193 198 }
194 199 return _backImageV;
195 200 }
  201 +
196 202 @end
... ...
CNLiveDisease/Classes/View/CNLiveGetImage.h
... ... @@ -10,7 +10,7 @@
10 10 NS_ASSUME_NONNULL_BEGIN
11 11  
12 12 @interface CNLiveGetImage : NSObject
13   -
  13 ++ (UIImage *)getImageName:(NSString *)imageName;
14 14 @end
15 15  
16 16 NS_ASSUME_NONNULL_END
... ...
CNLiveDisease/Classes/View/CNLiveGetImage.m
... ... @@ -9,4 +9,13 @@
9 9  
10 10 @implementation CNLiveGetImage
11 11  
  12 ++ (UIImage *)getImageName:(NSString *)imageName{
  13 + NSBundle *bundle = [NSBundle bundleForClass:[self class]];
  14 + NSURL *url = [bundle URLForResource:@"CNLiveDisease" withExtension:@"bundle"];
  15 + NSBundle *targetBundle = [NSBundle bundleWithURL:url];
  16 + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];
  17 + return image;
  18 +
  19 +}
  20 +
12 21 @end
... ...
Example/CNLiveDisease.xcodeproj/project.pbxproj
... ... @@ -312,6 +312,7 @@
312 312 "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework",
313 313 "${BUILT_PRODUCTS_DIR}/CNLiveDisease/CNLiveDisease.framework",
314 314 "${BUILT_PRODUCTS_DIR}/CNLiveImagePickerController/CNLiveImagePickerController.framework",
  315 + "${BUILT_PRODUCTS_DIR}/FLAnimatedImage/FLAnimatedImage.framework",
315 316 "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework",
316 317 "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework",
317 318 "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework",
... ... @@ -326,6 +327,7 @@
326 327 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework",
327 328 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveDisease.framework",
328 329 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveImagePickerController.framework",
  330 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLAnimatedImage.framework",
329 331 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework",
330 332 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework",
331 333 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework",
... ... @@ -349,6 +351,7 @@
349 351 "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework",
350 352 "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework",
351 353 "${BUILT_PRODUCTS_DIR}/CNLiveImagePickerController/CNLiveImagePickerController.framework",
  354 + "${BUILT_PRODUCTS_DIR}/FLAnimatedImage/FLAnimatedImage.framework",
352 355 "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework",
353 356 "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework",
354 357 "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework",
... ... @@ -362,6 +365,7 @@
362 365 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework",
363 366 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework",
364 367 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveImagePickerController.framework",
  368 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLAnimatedImage.framework",
365 369 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework",
366 370 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework",
367 371 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework",
... ...
Example/CNLiveDisease.xcworkspace/xcuserdata/yinqiaojuan.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
Example/CNLiveDisease/CNLiveAppDelegate.m
... ... @@ -12,12 +12,12 @@
12 12  
13 13 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
14 14 {
15   - UIWindow *window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
16   - window.backgroundColor = [UIColor whiteColor];
17   - UIViewController *vc = [[CNLiveViewController alloc]init];
18   - UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:vc];
19   - window.rootViewController = nav;
20   - [window makeKeyAndVisible];
  15 +// UIWindow *window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
  16 +// window.backgroundColor = [UIColor whiteColor];
  17 +// UIViewController *vc = [[CNLiveViewController alloc]init];
  18 +//// UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:vc];
  19 +// window.rootViewController = vc;
  20 +// [window makeKeyAndVisible];
21 21 // Override point for customization after application launch.
22 22 return YES;
23 23 }
... ...
Example/CNLiveDisease/CNLiveViewController.m
... ... @@ -37,7 +37,7 @@
37 37 CNLiveDiseaseController *vc = [[CNLiveDiseaseController alloc]init];
38 38 vc.view.backgroundColor = [UIColor whiteColor];
39 39 [self presentViewController:vc animated:YES completion:nil];
40   -// [self.navigationController pushViewController:vc animated:YES];
  40 +
41 41 }
42 42 - (void)didReceiveMemoryWarning
43 43 {
... ...
Example/Podfile
... ... @@ -15,6 +15,7 @@ target &#39;CNLiveDisease_Example&#39; do
15 15 pod 'CNLiveImagePickerController'
16 16 pod 'CNLiveAVCamera'
17 17 # pod 'CNLiveUploadManager'
  18 + pod 'FLAnimatedImage'
18 19 target 'CNLiveDisease_Tests' do
19 20 inherit! :search_paths
20 21 pod 'CNLiveBaseKit'
... ... @@ -24,6 +25,7 @@ target &#39;CNLiveDisease_Example&#39; do
24 25 pod 'CNLiveImagePickerController'
25 26 pod 'CNLiveAVCamera'
26 27 # pod 'CNLiveUploadManager'
  28 + pod 'FLAnimatedImage'
27 29  
28 30 end
29 31 end
... ...
Example/Podfile.lock
... ... @@ -5,14 +5,16 @@ PODS:
5 5 - MJExtension (~> 3.0.15.1)
6 6 - CNLiveCommonCategory (0.2.5):
7 7 - SDWebImage (~> 4.4.2)
8   - - CNLiveDisease (0.0.3):
  8 + - CNLiveDisease (0.0.5):
9 9 - CNLiveAVCamera
10 10 - CNLiveBaseKit
11 11 - CNLiveCommonCategory
12 12 - CNLiveImagePickerController
  13 + - FLAnimatedImage
13 14 - Masonry
14 15 - QMUIKit (~> 3.1.0)
15 16 - CNLiveImagePickerController (0.0.2)
  17 + - FLAnimatedImage (1.0.12)
16 18 - Masonry (1.0.2)
17 19 - MJExtension (3.0.15.1)
18 20 - QMUIKit (3.1.0):
... ... @@ -291,6 +293,7 @@ DEPENDENCIES:
291 293 - CNLiveCommonCategory
292 294 - CNLiveDisease (from `../`)
293 295 - CNLiveImagePickerController
  296 + - FLAnimatedImage
294 297 - Masonry
295 298 - QMUIKit (~> 3.1.0)
296 299  
... ... @@ -301,6 +304,7 @@ SPEC REPOS:
301 304 - CNLiveCommonCategory
302 305 - CNLiveImagePickerController
303 306 https://github.com/cocoapods/specs.git:
  307 + - FLAnimatedImage
304 308 - Masonry
305 309 - MJExtension
306 310 - QMUIKit
... ... @@ -314,13 +318,14 @@ SPEC CHECKSUMS:
314 318 CNLiveAVCamera: 7f3eba8eb1827f6e7a5047b0bb9f9f0bf19d1451
315 319 CNLiveBaseKit: 09a97c3411a91270fb68bfe20a1df2cdbcd2c524
316 320 CNLiveCommonCategory: 57cb8422ccf17ba5cc8fffe76851fa828c367d06
317   - CNLiveDisease: 8d80c9163497b37cbd2838898bb7c477868a158d
  321 + CNLiveDisease: 021cc3d2127bf9fb4198d7e569d12b638a8e5d23
318 322 CNLiveImagePickerController: 2be3ac0a75563f5945101ee6e0a787ad2fc15549
  323 + FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31
319 324 Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e
320 325 MJExtension: 19bc33ce2eee2d319760f5622562cf581a6ff756
321 326 QMUIKit: 33959d093f48bb64f754ad696c310887a0768c49
322 327 SDWebImage: c5594f1a19c48d526d321e548902b56b479cd508
323 328  
324   -PODFILE CHECKSUM: 441d26e990ff01b086d84ccbd3d0027e04e6ea1a
  329 +PODFILE CHECKSUM: 1914bf259da01d29bb52accd3589a566adee9132
325 330  
326 331 COCOAPODS: 1.5.3
... ...
Example/Pods/Local Podspecs/CNLiveDisease.podspec.json
1 1 {
2 2 "name": "CNLiveDisease",
3   - "version": "0.0.3",
  3 + "version": "0.0.5",
4 4 "summary": "智慧农业部分组件化",
5 5 "description": "TODO: Add long description of the pod here.",
6 6 "homepage": "http://bj.gitlab.cnlive.com/ios-team/CNLiveDisease",
... ... @@ -13,7 +13,7 @@
13 13 },
14 14 "source": {
15 15 "git": "http://bj.gitlab.cnlive.com/ios-team/CNLiveDisease.git",
16   - "tag": "0.0.3"
  16 + "tag": "0.0.5"
17 17 },
18 18 "platforms": {
19 19 "ios": "9.0"
... ... @@ -46,6 +46,9 @@
46 46 ],
47 47 "CNLiveAVCamera": [
48 48  
  49 + ],
  50 + "FLAnimatedImage": [
  51 +
49 52 ]
50 53 }
51 54 }
... ...
Example/Pods/Manifest.lock
... ... @@ -5,14 +5,16 @@ PODS:
5 5 - MJExtension (~> 3.0.15.1)
6 6 - CNLiveCommonCategory (0.2.5):
7 7 - SDWebImage (~> 4.4.2)
8   - - CNLiveDisease (0.0.3):
  8 + - CNLiveDisease (0.0.5):
9 9 - CNLiveAVCamera
10 10 - CNLiveBaseKit
11 11 - CNLiveCommonCategory
12 12 - CNLiveImagePickerController
  13 + - FLAnimatedImage
13 14 - Masonry
14 15 - QMUIKit (~> 3.1.0)
15 16 - CNLiveImagePickerController (0.0.2)
  17 + - FLAnimatedImage (1.0.12)
16 18 - Masonry (1.0.2)
17 19 - MJExtension (3.0.15.1)
18 20 - QMUIKit (3.1.0):
... ... @@ -291,6 +293,7 @@ DEPENDENCIES:
291 293 - CNLiveCommonCategory
292 294 - CNLiveDisease (from `../`)
293 295 - CNLiveImagePickerController
  296 + - FLAnimatedImage
294 297 - Masonry
295 298 - QMUIKit (~> 3.1.0)
296 299  
... ... @@ -301,6 +304,7 @@ SPEC REPOS:
301 304 - CNLiveCommonCategory
302 305 - CNLiveImagePickerController
303 306 https://github.com/cocoapods/specs.git:
  307 + - FLAnimatedImage
304 308 - Masonry
305 309 - MJExtension
306 310 - QMUIKit
... ... @@ -314,13 +318,14 @@ SPEC CHECKSUMS:
314 318 CNLiveAVCamera: 7f3eba8eb1827f6e7a5047b0bb9f9f0bf19d1451
315 319 CNLiveBaseKit: 09a97c3411a91270fb68bfe20a1df2cdbcd2c524
316 320 CNLiveCommonCategory: 57cb8422ccf17ba5cc8fffe76851fa828c367d06
317   - CNLiveDisease: 8d80c9163497b37cbd2838898bb7c477868a158d
  321 + CNLiveDisease: 021cc3d2127bf9fb4198d7e569d12b638a8e5d23
318 322 CNLiveImagePickerController: 2be3ac0a75563f5945101ee6e0a787ad2fc15549
  323 + FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31
319 324 Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e
320 325 MJExtension: 19bc33ce2eee2d319760f5622562cf581a6ff756
321 326 QMUIKit: 33959d093f48bb64f754ad696c310887a0768c49
322 327 SDWebImage: c5594f1a19c48d526d321e548902b56b479cd508
323 328  
324   -PODFILE CHECKSUM: 441d26e990ff01b086d84ccbd3d0027e04e6ea1a
  329 +PODFILE CHECKSUM: 1914bf259da01d29bb52accd3589a566adee9132
325 330  
326 331 COCOAPODS: 1.5.3
... ...