Commit e6c42abd authored by admin's avatar admin

修改添加字段崩溃的bug

parent e0dda623
...@@ -21,4 +21,15 @@ ...@@ -21,4 +21,15 @@
} }
return self; return self;
} }
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -21,4 +21,15 @@ ...@@ -21,4 +21,15 @@
} }
return self; return self;
} }
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -23,4 +23,16 @@ ...@@ -23,4 +23,16 @@
{ {
return [[self alloc] initWithName:name children:children]; return [[self alloc] initWithName:name children:children];
} }
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -23,5 +23,15 @@ ...@@ -23,5 +23,15 @@
{ {
return [[self alloc] initWithName:name children:children]; return [[self alloc] initWithName:name children:children];
} }
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -22,4 +22,16 @@ ...@@ -22,4 +22,16 @@
{ {
return [[self alloc] initWithName:name]; return [[self alloc] initWithName:name];
} }
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -179,10 +179,7 @@ NSLog(@"22level = %ld", level); ...@@ -179,10 +179,7 @@ NSLog(@"22level = %ld", level);
} }
- (CGFloat)treeView:(RATreeView *)treeView heightForRowForItem:(id)item
{
return 44;
}
- (BOOL)treeView:(RATreeView *)treeView canEditRowForItem:(id)item - (BOOL)treeView:(RATreeView *)treeView canEditRowForItem:(id)item
{ {
...@@ -196,6 +193,8 @@ NSLog(@"22level = %ld", level); ...@@ -196,6 +193,8 @@ NSLog(@"22level = %ld", level);
if (!_treeView) { if (!_treeView) {
_treeView = [[RATreeView alloc] initWithFrame:self.view.bounds]; _treeView = [[RATreeView alloc] initWithFrame:self.view.bounds];
_treeView.treeFooterView = [UIView new]; _treeView.treeFooterView = [UIView new];
_treeView.rowHeight = UITableViewAutomaticDimension;
_treeView.estimatedRowHeight = 150.0;
[self.view addSubview:_treeView]; [self.view addSubview:_treeView];
} }
return _treeView; return _treeView;
......
...@@ -13,4 +13,16 @@ ...@@ -13,4 +13,16 @@
if([key isEqualToString:@"description"]) if([key isEqualToString:@"description"])
self.descriptionText = value; self.descriptionText = value;
} }
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -9,5 +9,15 @@ ...@@ -9,5 +9,15 @@
#import "PictureDetailModel.h" #import "PictureDetailModel.h"
@implementation PictureDetailModel @implementation PictureDetailModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -9,5 +9,15 @@ ...@@ -9,5 +9,15 @@
#import "PictureListModel.h" #import "PictureListModel.h"
@implementation PictureListModel @implementation PictureListModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -9,5 +9,15 @@ ...@@ -9,5 +9,15 @@
#import "CommentModel.h" #import "CommentModel.h"
@implementation CommentModel @implementation CommentModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -9,5 +9,15 @@ ...@@ -9,5 +9,15 @@
#import "QuestionDetailModel.h" #import "QuestionDetailModel.h"
@implementation QuestionDetailModel @implementation QuestionDetailModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -51,6 +51,6 @@ ...@@ -51,6 +51,6 @@
@property (nonatomic, strong) NSString *principal_code; @property (nonatomic, strong) NSString *principal_code;
@property (nonatomic, strong) NSString *store_code; @property (nonatomic, strong) NSString *store_code;
@property (nonatomic, strong) NSString *store_uuid; @property (nonatomic, strong) NSString *store_uuid;
@property (nonatomic, strong) NSString *store_name; //@property (nonatomic, strong) NSString *store_name;
@end @end
...@@ -7,7 +7,19 @@ ...@@ -7,7 +7,19 @@
// //
#import "QuestionModel.h" #import "QuestionModel.h"
#include <objc/runtime.h>
@implementation QuestionModel @implementation QuestionModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface SearchToolBar : UIView <UITextFieldDelegate> @interface SearchToolBar : UIView
@property (nonatomic, strong) UITextField *searchTextFiled; // 搜索框 @property (nonatomic, strong) UITextField *searchTextFiled; // 搜索框
@property (nonatomic, strong) UIButton *queryButton; // 快速查询按钮 @property (nonatomic, strong) UIButton *queryButton; // 快速查询按钮
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
{ {
if (!_searchTextFiled) { if (!_searchTextFiled) {
_searchTextFiled = [[UITextField alloc] init]; _searchTextFiled = [[UITextField alloc] init];
_searchTextFiled.delegate = self;
_searchTextFiled.font = [UIFont systemFontOfSize:14.0]; _searchTextFiled.font = [UIFont systemFontOfSize:14.0];
_searchTextFiled.backgroundColor = [UIColor whiteColor]; _searchTextFiled.backgroundColor = [UIColor whiteColor];
_searchTextFiled.translatesAutoresizingMaskIntoConstraints = NO; _searchTextFiled.translatesAutoresizingMaskIntoConstraints = NO;
...@@ -109,12 +108,6 @@ ...@@ -109,12 +108,6 @@
return _queryButton; return _queryButton;
} }
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if ([textField resignFirstResponder]) {
return YES;
}
return NO;
}
@end @end
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#define kQuestionListCell @"questionListTableViewCell" #define kQuestionListCell @"questionListTableViewCell"
#define kThumbTag 745645 #define kThumbTag 745645
@interface QuestionViewController () <UITableViewDelegate, UITableViewDataSource, TaxisViewDelegate, ScopeTableViewDelegate, GroupTableViewDelegate, CategoryTableViewDelegate, StateTableViewDelegate, TimeTableViewDelegate> @interface QuestionViewController () <UITextFieldDelegate,UITableViewDelegate, UITableViewDataSource, TaxisViewDelegate, ScopeTableViewDelegate, GroupTableViewDelegate, CategoryTableViewDelegate, StateTableViewDelegate, TimeTableViewDelegate>
@property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *allQuestionArray; @property (nonatomic, strong) NSMutableArray *allQuestionArray;
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
@property (nonatomic, assign) NSInteger stateRow; @property (nonatomic, assign) NSInteger stateRow;
@property (nonatomic, assign) NSInteger timeRow; @property (nonatomic, assign) NSInteger timeRow;
@property (nonatomic, strong) NSLayoutConstraint *searchBottom;
@end @end
@implementation QuestionViewController @implementation QuestionViewController
...@@ -404,7 +404,21 @@ ...@@ -404,7 +404,21 @@
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"content CONTAINS %@ || title CONTAINS %@", self.searchBar.searchTextFiled.text, self.searchBar.searchTextFiled.text]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"content CONTAINS %@ || title CONTAINS %@", self.searchBar.searchTextFiled.text, self.searchBar.searchTextFiled.text];
NSArray *arrayPre=[_allQuestionArray filteredArrayUsingPredicate:predicate]; NSArray *arrayPre=[_allQuestionArray filteredArrayUsingPredicate:predicate];
_allQuestionArray = [NSMutableArray arrayWithArray:arrayPre]; _allQuestionArray = [NSMutableArray arrayWithArray:arrayPre];
[self.tableView reloadData];
if (_allQuestionArray.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
_tableView = nil;
}
self.noDataView.backgroundColor = [UIColor whiteColor];
} else {
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
self.searchBar.backgroundColor = kSectionBackGroundColor;
[self.tableView reloadData];
}
} }
// 重置按钮 // 重置按钮
...@@ -774,7 +788,7 @@ ...@@ -774,7 +788,7 @@
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight]; [self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-50];
[self.view addConstraint:tableBottom]; [self.view addConstraint:tableBottom];
} }
return _tableView; return _tableView;
...@@ -784,6 +798,7 @@ ...@@ -784,6 +798,7 @@
{ {
if (!_searchBar) { if (!_searchBar) {
_searchBar = [[SearchToolBar alloc] init]; _searchBar = [[SearchToolBar alloc] init];
_searchBar.searchTextFiled.delegate = self;
_searchBar.translatesAutoresizingMaskIntoConstraints = NO; _searchBar.translatesAutoresizingMaskIntoConstraints = NO;
[_searchBar.queryButton addTarget:self action:@selector(searchBarClick:) forControlEvents:UIControlEventTouchUpInside]; [_searchBar.queryButton addTarget:self action:@selector(searchBarClick:) forControlEvents:UIControlEventTouchUpInside];
[self.view insertSubview:_searchBar aboveSubview:_tableView]; [self.view insertSubview:_searchBar aboveSubview:_tableView];
...@@ -799,8 +814,8 @@ ...@@ -799,8 +814,8 @@
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_searchBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_searchBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight]; [self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_searchBar attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; self.searchBottom = [NSLayoutConstraint constraintWithItem:_searchBar attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom]; [self.view addConstraint:self.searchBottom];
} }
return _searchBar; return _searchBar;
} }
...@@ -829,12 +844,37 @@ ...@@ -829,12 +844,37 @@
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if (![self.searchBar.searchTextFiled isExclusiveTouch]) { if (![self.searchBar.searchTextFiled isExclusiveTouch]) {
[self.searchBar.searchTextFiled resignFirstResponder]; [self.searchBar.searchTextFiled resignFirstResponder];
} }
} }
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if ([self.searchBar.searchTextFiled resignFirstResponder]) {
return YES;
}
return NO;
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
self.searchBottom.constant = -256;
[UIView animateWithDuration:0.23 animations:^{
[self.searchBar layoutIfNeeded];
}];
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
self.searchBottom.constant = 0;
[UIView animateWithDuration:0.23 animations:^{
[self.searchBar layoutIfNeeded];
}];
}
/* /*
#pragma mark - Navigation #pragma mark - Navigation
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile]; image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
self.alreadyView.image = image; self.alreadyView.image = image;
NSLog(@"taskList = %@", taskList.state); NSLog(@"taskList = %@", taskList.state);
if ([taskList.state isEqualToString:@"initial"]) { if ([taskList.state isEqualToString:@"submitted"]) {
NSString *str = [NSString stringWithFormat:@"巡检进度:未处理"]; NSString *str = [NSString stringWithFormat:@"巡检进度:未处理"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str]; NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)]; [strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
...@@ -104,8 +104,8 @@ ...@@ -104,8 +104,8 @@
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)]; [strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kNavigationBarColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)]; [strAttr addAttributes:@{NSForegroundColorAttributeName:kNavigationBarColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr]; [self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressDealWithColor; self.alreadyLabel.textColor = kNavigationBarColor;
self.allLabel.textColor = kProgressDealWithColor; self.allLabel.textColor = kNavigationBarColor;
} else if ([taskList.state isEqualToString:@"expired"]){ } else if ([taskList.state isEqualToString:@"expired"]){
NSString *str = [NSString stringWithFormat:@"巡检进度:已过期"]; NSString *str = [NSString stringWithFormat:@"巡检进度:已过期"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str]; NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
...@@ -114,16 +114,7 @@ ...@@ -114,16 +114,7 @@
[self.progressLabel setAttributedText:strAttr]; [self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressOverDueColor; self.alreadyLabel.textColor = kProgressOverDueColor;
self.allLabel.textColor = kProgressOverDueColor; self.allLabel.textColor = kProgressOverDueColor;
} else if ([taskList.state isEqualToString:@"submitted"]) {
NSString *str = [NSString stringWithFormat:@"巡检进度:已提交"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressDealWithColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressDealWithColor;
self.allLabel.textColor = kProgressDealWithColor;
} else { } else {
} }
} }
......
...@@ -9,5 +9,15 @@ ...@@ -9,5 +9,15 @@
#import "TaskListModel.h" #import "TaskListModel.h"
@implementation TaskListModel @implementation TaskListModel
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -212,7 +212,6 @@ ...@@ -212,7 +212,6 @@
{ {
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL]; NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
NSLog(@"urlllll = %@", url);
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url]; HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{ NSDictionary *parameters = @{
@"userUuid":[[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"], @"userUuid":[[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"],
...@@ -220,7 +219,6 @@ ...@@ -220,7 +219,6 @@
@"pageNumber":@(0), @"pageNumber":@(0),
@"pageSize":@(10) @"pageSize":@(10)
}; };
NSLog(@"parametersssssss = %@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; [MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) { [httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
...@@ -440,7 +438,7 @@ ...@@ -440,7 +438,7 @@
} else if (_selectRow == 1) { } else if (_selectRow == 1) {
_screenView.textView.text = @""; _screenView.textView.text = @"";
[parameters setObject:@"initial" forKey:@"state"]; [parameters setObject:@"submitted" forKey:@"state"];
} else if (_selectRow == 2) { } else if (_selectRow == 2) {
_screenView.textView.text = @""; _screenView.textView.text = @"";
[parameters setObject:@"processing" forKey:@"state"]; [parameters setObject:@"processing" forKey:@"state"];
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
} }
if ([taskDetail.state isEqualToString:@"initial"]) { if ([taskDetail.state isEqualToString:@"submitted"]) {
if (taskDetail.reportCount == 0 || taskDetail.questionCount == 0) { if (taskDetail.reportCount == 0 || taskDetail.questionCount == 0) {
self.progressLabel.text = @"0%"; self.progressLabel.text = @"0%";
} else { } else {
......
...@@ -21,4 +21,16 @@ ...@@ -21,4 +21,16 @@
} }
return self; return self;
} }
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -22,4 +22,16 @@ ...@@ -22,4 +22,16 @@
} }
return self; return self;
} }
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -21,4 +21,15 @@ ...@@ -21,4 +21,15 @@
} }
return self; return self;
} }
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -21,5 +21,15 @@ ...@@ -21,5 +21,15 @@
} }
return self; return self;
} }
- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues{
Class cls = self.class;
for (NSString *key in keyedValues.allKeys) {
NSString *varName = [NSString stringWithFormat:@"_%@", key];
const char *c_key = [varName cStringUsingEncoding:NSUTF8StringEncoding];
Ivar var = class_getInstanceVariable(cls, c_key);
if (var) {
[self setValue:[keyedValues objectForKey:key] forKey:key];
}
}
}
@end @end
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#import "Constant.h" #import "Constant.h"
#import "Url.h" #import "Url.h"
#include <objc/runtime.h>
#endif /* redstar_pch */ #endif /* redstar_pch */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment