1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//
// ICRQStoreStudyViewController.m
// XFFruit
//
// Created by Xummer on 6/7/15.
// Copyright (c) 2015 Xummer. All rights reserved.
//
#import "ICRQStoreStudyViewController.h"
#import "IBTTableViewInfo.h"
#import "ICRQuestionManager.h"
@interface ICRQStoreStudyViewController ()
@property (strong, nonatomic) IBTTableViewInfo *m_tableViewInfo;
@end
@implementation ICRQStoreStudyViewController
#pragma mark - Life Cycle
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Private Method
- (void)initScrollViewWithRect:(CGRect)rect {
self.m_tableViewInfo = [[IBTTableViewInfo alloc] initWithFrame:rect style:UITableViewStyleGrouped];
IBTTableView *tableV = [_m_tableViewInfo getTableView];
tableV.bHandleKeyboard = YES;
tableV.backgroundColor = [UIColor clearColor];
self.m_contentScrollView = tableV;
IBTTableViewSectionInfo *secInfo;
IBTTableViewCellInfo *cellInfo;
CGFloat fCellHeight = IBT_DEFAULT_CELL_HEIGHT;
secInfo = [IBTTableViewSectionInfo sectionInfoDefaut];
// Change Password
cellInfo =
[IBTTableViewCellInfo normalCellForSel:nil target:nil
title:@"商品"
rightValue: @"当前库存"
accessoryType:UITableViewCellAccessoryNone];
cellInfo.selectionStyle = UITableViewCellSelectionStyleNone;
cellInfo.fCellHeight = fCellHeight;
[secInfo addCell:cellInfo];
NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"lineNo" ascending:YES];
NSArray* sortedArray=[self.m_question.details sortedArrayUsingDescriptors:@[sort]];
// NSUInteger i = 0;
// for (NSDictionary *dictItem in self.m_arrOptions) {
//
// NSDictionary *dictAnsw = [arrAnswers safeObjectAtIndex:i];
// id answResult = dictAnsw[ @"intResult" ];
// NSString *text = answResult ? [NSString stringWithFormat:@"%@", answResult] : nil;
//
// cellInfo = [IBTTableViewCellInfo editorCellForSel:nil
// target:nil
// title:dictItem[ @"content" ]
// margin:0
// tip:@"请输入"
// autoCorrect:NO
// focus:NO
// text:text];
// [cellInfo addUserInfoValue:@( NSTextAlignmentRight )
// forKey:CInfoEditorAlignKey];
// [cellInfo addUserInfoValue:@( UIKeyboardTypeNumberPad )
// forKey:CInfoEditorKeyboardTypeKey];
// [secInfo addCell:cellInfo];
//
// i ++;
// }
[self.m_tableViewInfo addSection:secInfo];
}
#pragma mark - Actions
- (void)onNextBtnAction:(__unused id)sender {
IBTTableViewSectionInfo *secInfo = [self.m_tableViewInfo getSectionAt:0];
NSMutableArray *mArrAnswers = [NSMutableArray array];
BOOL bIsAllAnswered = YES;
for (NSUInteger i = 1; i < [secInfo getCellCount]; i ++) {
IBTTableViewCellInfo *cellInfo = [secInfo getCellAt:i];
NSString *nsText = [cellInfo getUserInfoValueForKey:CInfoEditorTextKey];
if (nsText.length > 0) {
ICRAnswerDetail *dE = [ICRAnswerDetail DBObject];
dE.uuid = [[ICRUserUtil sharedInstance] mobileID];
dE.index = i;
dE.numberValue = [nsText integerValue];
[mArrAnswers addObject:[dE dictForCommit]];
}
else {
bIsAllAnswered = NO;
break;
}
}
if (!bIsAllAnswered) {
self.m_answer.bIsAnswered = NO;
return;
}
self.m_answer.details = mArrAnswers;
self.m_answer.bIsAnswered = YES;
ICRQuestionManager *mgr = [ICRQuestionManager sharedManager];
UIViewController *qVC = [mgr questionViewControlAtIndex:self.m_uiIndex + 1];
if (qVC) {
[self PushViewController:qVC animated:YES];
}
else {
[self openResultView];
}
}
@end