forked from lludo/QuickDialog
/
SampleDataBuilder.m
520 lines (406 loc) · 22.7 KB
/
SampleDataBuilder.m
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
//
// Copyright 2011 ESCOZ Inc - http://escoz.com
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND, either express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import "LoginController.h"
#import "SampleDataBuilder.h"
#import "QRootElement.h"
#import "QSection.h"
@implementation SampleDataBuilder
+ (QRootElement *)createWithInitDefault {
QRootElement *subForm = [[QRootElement alloc] init];
subForm.grouped = YES;
subForm.title = @"Default Initialization";
QSection *subsection = [[QSection alloc] initWithTitle:@"SubSection"];
[subForm addSection:subsection];
[subsection addElement:[[QLabelElement alloc] init]];
[subsection addElement:[[QBadgeElement alloc] init]];
[subsection addElement:[[QBooleanElement alloc] init]];
[subsection addElement:[[QButtonElement alloc] init]];
[subsection addElement:[[QDateTimeInlineElement alloc] init]];
[subsection addElement:[[QFloatElement alloc] init]];
[subsection addElement:[[QMapElement alloc] init]];
[subsection addElement:[[QRadioElement alloc] init]];
[subsection addElement:[[QRadioItemElement alloc] init]];
[subsection addElement:[[QTextElement alloc] init]];
[subsection addElement:[[QWebElement alloc] init]];
return subForm;
}
+ (QRootElement *)createWithInitAndKey {
QRootElement *subForm = [[QRootElement alloc] init];
subForm.grouped = YES;
subForm.title = @"Initialization With Key";
QSection *subsection = [[QSection alloc] initWithTitle:@"SubSection"];
[subForm addSection:subsection];
[subsection addElement:[[QLabelElement alloc] initWithKey:@"Key1"]];
[subsection addElement:[[QBadgeElement alloc] initWithKey:@"Key1"]];
[subsection addElement:[[QBooleanElement alloc] initWithKey:@"Key1"]];
[subsection addElement:[[QButtonElement alloc] initWithKey:@"Key1"]];
[subsection addElement:[[QDateTimeInlineElement alloc] initWithKey:@"Key1"]];
[subsection addElement:[[QFloatElement alloc] initWithKey:@"Key1"]];
[subsection addElement:[[QMapElement alloc] initWithKey:@"Key1"]];
[subsection addElement:[[QRadioElement alloc] initWithKey:@"Key1"]];
[subsection addElement:[[QRadioItemElement alloc] initWithKey:@"Key1"]];
[subsection addElement:[[QTextElement alloc] initWithKey:@"Key1"]];
[subsection addElement:[[QWebElement alloc] initWithKey:@"Key1"]];
return subForm;
}
+ (QElement *)reallyLongList {
QRootElement *subForm = [[QRootElement alloc] init];
subForm.title = @"Really long list";
QSection *subsection = [[QSection alloc] initWithTitle:@"Long List"];
for (int i = 0; i<1000; i++){
QBooleanElement *bool1 = [[QBooleanElement alloc] initWithTitle:[NSString stringWithFormat:@"Option %d", i] BoolValue:(i % 3 == 0)];
bool1.onImage = [UIImage imageNamed:@"imgOn"];
bool1.offImage = [UIImage imageNamed:@"imgOff"];
[subsection addElement:bool1];
}
[subForm addSection:subsection];
return subForm;
}
+ (QRootElement *)createSampleFormRoot {
QRootElement *subForm = [[QRootElement alloc] init];
QSection *subsection = [[QSection alloc] initWithTitle:@"SubSection"];
subForm.grouped = YES;
subForm.title = @"Subform";
[subsection addElement:[[QLabelElement alloc] initWithTitle:@"Some title" Value:@"Some value"]];
QEntryElement *elementEntry = [[QEntryElement alloc] initWithTitle:@"Entry" Value:nil Placeholder:@"type here"];
elementEntry.key = @"entryElement";
[subsection addElement:elementEntry];
[subsection addElement:[[QBooleanElement alloc] initWithTitle:@"boolean" BoolValue:YES]];
[subsection addElement:[[QEntryElement alloc] initWithTitle:@"Entry 2" Value:@"Some value" Placeholder:@"type here two"]];
[subForm addSection:subsection];
QSection *subsection2 = [[QSection alloc] init];
QButtonElement *myButton = [[QButtonElement alloc] initWithTitle:@"Change Entry"];
myButton.controllerAction = @"handleChangeEntryExample:";
[subsection2 addElement:myButton];
[subForm addSection:subsection2];
QSection *subsection3 = [[QSection alloc] init];
QBooleanElement *bool1 = [[QBooleanElement alloc] initWithTitle:@"First option" BoolValue:YES];
bool1.onImage = [UIImage imageNamed:@"imgOn"];
bool1.offImage = [UIImage imageNamed:@"imgOff"];
[subsection3 addElement:bool1];
QBooleanElement *bool2 = [[QBooleanElement alloc] initWithTitle:@"Second option" BoolValue:NO];
bool2.onImage = [UIImage imageNamed:@"imgOn"];
bool2.offImage = [UIImage imageNamed:@"imgOff"];
bool2.controllerAction = @"exampleAction:";
[subsection3 addElement:bool2];
QTextElement *element2 = [[QTextElement alloc] initWithText:@"You get all kinds of notifications on your iOS device: new email, texts, friend requests, and more. With Notification Center, you can keep track of them all in one convenient location. Just swipe down from the top of any screen to enter Notification Center. Choose which notifications you want to see. Even see a stock ticker and the current weather. New notifications appear briefly at the top of your screen, without interrupting what you’re doing. And the Lock screen displays notifications so you can act on them with just a swipe. Notification Center is the best way to stay on top of your life’s breaking news."];
element2.font = [UIFont boldSystemFontOfSize:12];
QSection *subsection4 = [[QSection alloc] init];
[subsection4 addElement:element2];
[subForm addSection:subsection3];
[subForm addSection:subsection4];
return subForm;
}
+ (QRootElement *)createSlidersRoot {
QRootElement *sliders = [[QRootElement alloc] init];
sliders.grouped = YES;
sliders.title = @"Sliders";
QSection *detailsSection = [[QSection alloc] initWithTitle:@"Slide left and right"];
[sliders addSection:detailsSection];
[detailsSection addElement:[[QFloatElement alloc] initWithValue:0.5]];
[detailsSection addElement:[[QFloatElement alloc] initWithTitle:@"Short" value:0.7]];
[detailsSection addElement:[[QFloatElement alloc] initWithTitle:@"Really really long title" value:1]];
return sliders;
}
+ (QElement *)createSampleControls {
QRootElement *root = [[QRootElement alloc] init];
root.grouped = YES;
root.title = @"Sample Controls";
QSection *controls = [[QSection alloc] initWithTitle:@"Change something"];
QLabelElement *element1 = [[QLabelElement alloc] initWithTitle:@"Label" Value:@"element"];
QRadioElement *radioElement = [[QRadioElement alloc] initWithItems:[[NSArray alloc] initWithObjects:@"Option 1", @"Option 2", @"Option 3", nil] selected:0 title:@"Radio"];
radioElement.key = @"radio1";
QBooleanElement *boolElement = [[QBooleanElement alloc] initWithTitle:@"Boolean Element" BoolValue:YES];
boolElement.controllerAction = @"exampleAction:";
boolElement.key = @"bool1";
QEntryElement *entryElement = [[QEntryElement alloc] initWithTitle:@"Entry Element" Value:nil Placeholder:@"type here"];
entryElement.key = @"entry1";
controls.footer = @"More controls will be added.";
[controls addElement:element1];
[controls addElement:radioElement];
[controls addElement:entryElement];
[controls addElement:boolElement];
QDateTimeInlineElement *dateElement = [[QDateTimeInlineElement alloc] initWithTitle:@"DateTime" date:[NSDate date]];
dateElement.key = @"date1";
[controls addElement:dateElement];
QFloatElement *slider = [[QFloatElement alloc] initWithTitle:@"Float Element" value:0.5];
slider.key = @"slider1";
[controls addElement:slider];
QDecimalElement *decimal = [[QDecimalElement alloc] initWithTitle:@"Decimal Element" value:0.5];
decimal.key = @"decimal1";
decimal.fractionDigits = 3;
[controls addElement:decimal];
QLabelElement *element2 = [[QLabelElement alloc] initWithTitle:@"Label Different Height" Value:@"70"];
element2.height = 70;
[controls addElement:element2];
QSection *btnSection = [[QSection alloc] init];
QButtonElement *button = [[QButtonElement alloc] initWithTitle:@"Show form values"];
button.onSelected = ^{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello"
message:[NSString stringWithFormat:@"1: %d\n2: %@\n3: %d\n4:%@\n5:%f\n6:%f",
radioElement.selected ,
entryElement.textValue,
boolElement.boolValue,
dateElement.dateValue ,
slider.floatValue,
decimal.floatValue]
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
};
[btnSection addElement:button];
QSection *btnSection2 = [[QSection alloc] init];
QButtonElement *button2 = [[QButtonElement alloc] initWithTitle:@"Fetch into dictionary"];
button2.onSelected = ^{
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[root fetchValueIntoObject:dict];
NSString *msg = @"Values:";
for (NSString *aKey in dict){
msg = [msg stringByAppendingFormat:@"\n- %@: %@", aKey, [dict valueForKey:aKey]];
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello"
message:msg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
};
[btnSection2 addElement:button2];
btnSection2.footer = @"Here's a really long footer text that could be used to make your users happy!";
[root addSection:controls];
[root addSection:btnSection];
[root addSection:btnSection2];
return root;
}
+ (QElement *)createRadioRoot {
QRootElement *root = [[QRootElement alloc] init];
root.title = @"Radio";
root.grouped = YES;
QSection *section1 = [[QSection alloc] initWithTitle:@"Radio element with push"];
[section1 addElement:[[QRadioElement alloc] initWithItems:[NSArray arrayWithObjects:@"Football", @"Soccer", @"Formula 1", nil] selected:0]];
[section1 addElement:[[QRadioElement alloc] initWithItems:[NSArray arrayWithObjects:@"Football", @"Soccer", @"Formula 1", nil] selected:0 title:@"Sport"]];
QRadioElement *elementWithAction = [[QRadioElement alloc] initWithItems:[NSArray arrayWithObjects:@"Ferrari", @"McLaren", @"Lotus", nil] selected:0 title:@"WithAction"];
elementWithAction.controllerAction = @"exampleAction:";
[section1 addElement:elementWithAction];
[root addSection:section1];
QSection *section2 = [[QRadioSection alloc] initWithItems:[NSArray arrayWithObjects:@"Football", @"Soccer", @"Formula 1", nil] selected:0 title:@"Sport"];
[root addSection:section2];
return root;
}
+ (QRootElement *)createWebAndMapRoot {
QRootElement *root = [[QRootElement alloc] init];
root.title = @"Web and map";
QWebElement *element1 = [[QWebElement alloc] initWithTitle:@"ESCOZ Inc" url:@"http://escoz.com"];
QWebElement *element2 = [[QWebElement alloc] initWithTitle:@"Quicklytics" url:@"http://escoz.com/quicklytics"];
QMapElement *element4 = [[QMapElement alloc] initWithTitle:@"Florianopolis, Brazil" coordinate:CLLocationCoordinate2DMake(-27.59, -48.55)];
QSection *section1 = [[QSection alloc] init];
[section1 addElement:element1];
[section1 addElement:element2];
[section1 addElement:element4];
[root addSection:section1];
return root;
}
+ (QRootElement *)createTextRoot {
QRootElement *root = [[QRootElement alloc] init];
root.title = @"Text";
QTextElement *element1 = [[QTextElement alloc] initWithText:
@"Preparing for her flight\n"
"I held with all my might\n"
"Fearing my deepest fright\n"
"She walked into the night\n"
"She turned for one last look\n"
"She looked me in the eye\n"
"I said, \"I Love You...\n"
"Good-bye\""];
QTextElement *element2 = [[QTextElement alloc] initWithText:@"You get all kinds of notifications on your iOS device: new email, texts, friend requests, and more. With Notification Center, you can keep track of them all in one convenient location. Just swipe down from the top of any screen to enter Notification Center. Choose which notifications you want to see. Even see a stock ticker and the current weather. New notifications appear briefly at the top of your screen, without interrupting what you’re doing. And the Lock screen displays notifications so you can act on them with just a swipe. Notification Center is the best way to stay on top of your life’s breaking news."];
element2.font = [UIFont boldSystemFontOfSize:12];
QTextElement *element3 = [[QTextElement alloc] initWithText:@"Quicklytics App!"];
element3.font = [UIFont fontWithName:@"Cochin-BoldItalic" size:24];
element3.color = [UIColor blueColor];
QSection *section1 = [[QSection alloc] init];
[section1 addElement:element3];
[section1 addElement:element1];
[section1 addElement:element2];
[root addSection:section1];
return root;
}
+ (QRootElement *)createLabelsRoot {
QRootElement *root = [[QRootElement alloc] init];
root.title = @"Labels";
root.grouped = YES;
QSection *s1 = [[QSection alloc] initWithTitle:@"LabelElement"];
[s1 addElement:[[QLabelElement alloc] initWithTitle:@"With no value" Value:nil]];
[s1 addElement:[[QLabelElement alloc] initWithTitle:@"With a value" Value:@"Value"]];
[s1 addElement:[[QLabelElement alloc] initWithTitle:@"Or a simple number" Value:@"123"]];
QSection *s2 = [[QSection alloc] initWithTitle:@"BadgeElement"];
QBadgeElement *badge1 = [[QBadgeElement alloc] initWithTitle:@"With a badge" Value:@"1"];
[s2 addElement:badge1];
QBadgeElement *badge2 = [[QBadgeElement alloc] initWithTitle:@"With a pink badge" Value:@"123"];
badge2.badgeColor = [UIColor colorWithRed:0.9518 green:0.3862 blue:0.4113 alpha:1.0000];
[s2 addElement:badge2];
QSection *secImg = [[QSection alloc] initWithTitle:@"Images"];
QLabelElement *b1 = [[QLabelElement alloc] initWithTitle:@"Processor" Value:@"OK"];
b1.image = [UIImage imageNamed:@"intel"];
[secImg addElement:b1];
QLabelElement *b2 = [[QLabelElement alloc] initWithTitle:@"iPhone" Value:@"OK"];
b2.image = [UIImage imageNamed:@"iPhone"];
[secImg addElement:b2];
QBadgeElement *b3 = [[QBadgeElement alloc] initWithTitle:@"Keyboard" Value:@"ERROR"];
b3.image = [UIImage imageNamed:@"keyboard"];
b3.badgeColor = [UIColor redColor];
[secImg addElement:b3];
QBadgeElement *badge3 = [[QBadgeElement alloc] initWithTitle:@"With some action" Value:@"123"];
badge3.badgeColor = [UIColor purpleColor];
QSection *sec = [[QSection alloc] initWithTitle:@"Jazzin.."];
[badge3 addSection:sec];
QBadgeElement *b4 = [[QBadgeElement alloc] initWithTitle:@"With a really really really long title" Value:@"YEAH"];
[s2 addElement:b4];
[s2 addElement:badge3];
[sec addElement:[[QBadgeElement alloc] initWithTitle:@"Test" Value:@"0"]];
[sec addElement:[[QBadgeElement alloc] initWithTitle:@"Test 2" Value:@"10"]];
[sec addElement:[[QBadgeElement alloc] initWithTitle:@"Test 3" Value:@"200"]];
[sec addElement:[[QBadgeElement alloc] initWithTitle:@"Test 4" Value:@"1000"]];
[sec addElement:[[QBadgeElement alloc] initWithTitle:@"Test 5" Value:@"TEST"]];
[root addSection:s1];
[root addSection:s2];
[root addSection:secImg];
return root;
}
+ (QRootElement *)createEntryRoot {
QRootElement *root = [[QRootElement alloc] init];
root.title = @"Entry";
root.grouped = YES;
QSection *firstSection = [[QSection alloc] initWithTitle:@"Entry Elements"];
[firstSection addElement:[[QEntryElement alloc] initWithTitle:nil Value:nil Placeholder:@"placeholder"]];
[firstSection addElement:[[QEntryElement alloc] initWithTitle:@"With Title" Value:nil Placeholder:@"text here"]];
[firstSection addElement:[[QEntryElement alloc] initWithTitle:@"With Very Long Title" Value:@"" Placeholder:@"text"]];
[root addSection:firstSection];
QSection *traitsSection = [[QSection alloc] initWithTitle:@"UITextInputTraits"];
QEntryElement *secureElement = [[QEntryElement alloc] initWithTitle:@"Secure" Value:@"" Placeholder:@"YES"];
secureElement.secureTextEntry = YES;
[traitsSection addElement:secureElement];
QEntryElement *keyboardTypeElement = [[QEntryElement alloc] initWithTitle:@"KB Type" Value:@"" Placeholder:@"NumberPad"];
keyboardTypeElement.keyboardType = UIKeyboardTypeNumberPad;
[traitsSection addElement:keyboardTypeElement];
QEntryElement *keyboardAppearanceElement = [[QEntryElement alloc] initWithTitle:@"KB Appearance" Value:@"" Placeholder:@"Alert"];
keyboardAppearanceElement.keyboardAppearance = UIKeyboardAppearanceAlert;
[traitsSection addElement:keyboardAppearanceElement];
QEntryElement *correctionElement = [[QEntryElement alloc] initWithTitle:@"Correction" Value:@"" Placeholder:@"No"];
correctionElement.autocorrectionType = UITextAutocorrectionTypeNo;
[traitsSection addElement:correctionElement];
QEntryElement *capitalizationElement = [[QEntryElement alloc] initWithTitle:@"Capitalization" Value:@"" Placeholder:@"AllCharacters"];
capitalizationElement.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
[traitsSection addElement:capitalizationElement];
QEntryElement *googleElement = [[QEntryElement alloc] initWithTitle:@"Return Key" Value:@"" Placeholder:@"Google"];
googleElement.returnKeyType = UIReturnKeyGoogle;
[traitsSection addElement:googleElement];
QEntryElement *enableReturnElement = [[QEntryElement alloc] initWithTitle:@"Auto-Enable Return" Value:@"" Placeholder:@"YES"];
enableReturnElement.enablesReturnKeyAutomatically = YES;
[traitsSection addElement:enableReturnElement];
[root addSection:traitsSection];
return root;
}
+ (QRootElement *)createSortingRoot {
QRootElement *root = [[QRootElement alloc] init];
root.title = @"Sorting";
root.grouped = YES;
QSortingSection *sortingSection = [[QSortingSection alloc] init];
sortingSection.key = @"sortedSection";
[sortingSection addElement:[[QLabelElement alloc] initWithTitle:@"First" Value:@"1"]];
[sortingSection addElement:[[QLabelElement alloc] initWithTitle:@"Second" Value:@"2"]];
[sortingSection addElement:[[QLabelElement alloc] initWithTitle:@"Third" Value:@"3"]];
[sortingSection addElement:[[QLabelElement alloc] initWithTitle:@"Forth" Value:@"4"]];
[sortingSection addElement:[[QLabelElement alloc] initWithTitle:@"Fifth" Value:@"5"]];
int i = 1;
for (QElement * el in sortingSection.elements){
el.key = [NSString stringWithFormat:@"item %d", i++];
}
[root addSection:sortingSection];
QSection *action = [[QSection alloc] init];
QButtonElement *button = [[QButtonElement alloc] initWithTitle:@"Read Order"];
button.onSelected = ^{
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[sortingSection fetchValueIntoObject:dict];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello"
message:[NSString stringWithFormat:@"Order: %@", dict ]
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
};
[action addElement:button];
[root addSection:action];
return root;
}
+ (QRootElement *)createDateTimeRoot {
QRootElement *root = [[QRootElement alloc] init];
root.title = @"Date Time";
root.grouped = YES;
QSection *section = [[QSection alloc] init];
section.title = @"Inline editing";
QDateTimeInlineElement *el2 = [[QDateTimeInlineElement alloc] initWithTitle:@"Today" date:[NSDate date]];
[section addElement:el2];
QDateTimeInlineElement *el3 = [[QDateTimeInlineElement alloc] initWithTitle:@"Date only" date:[NSDate date]];
el3.mode = UIDatePickerModeDate;
[section addElement:el3];
QDateTimeInlineElement *el4 = [[QDateTimeInlineElement alloc] initWithTitle:@"Time only" date:[NSDate date]];
el3.mode = UIDatePickerModeTime;
[section addElement:el4];
QSection *section2 = [[QSection alloc] init];
section2.title = @"Push editing";
QDateTimeElement *el5 = [[QDateTimeElement alloc] initWithTitle:@"Time only" date:[NSDate date]];
el5.mode = UIDatePickerModeTime;
[section2 addElement:el5];
QDateTimeElement *el6 = [[QDateTimeElement alloc] initWithTitle:@"Date only" date:[NSDate date]];
el6.mode = UIDatePickerModeDate;
[section2 addElement:el6];
QDateTimeElement *el7 = [[QDateTimeElement alloc] initWithTitle:@"Full Date" date:[NSDate date]];
el7.mode = UIDatePickerModeDateAndTime;
[section2 addElement:el7];
[root addSection:section];
[root addSection:section2];
return root;
}
+ (QRootElement *)create {
QRootElement *root = [[QRootElement alloc] init];
root.grouped = YES;
root.title = @"QuickForms!";
QSection *sectionSamples = [[QSection alloc] init];
sectionSamples.headerView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"quickdialog"]];
[sectionSamples addElement:[LoginController createLoginForm]];
[sectionSamples addElement:[self createSampleControls]];
[sectionSamples addElement:[self createSampleFormRoot]];
[sectionSamples addElement:[self reallyLongList]];
QSection *sectionElements = [[QSection alloc] initWithTitle:@"Usage examples"];
[sectionElements addElement:[self createLabelsRoot]];
[sectionElements addElement:[self createEntryRoot]];
[sectionElements addElement:[self createSlidersRoot]];
[sectionElements addElement:[self createRadioRoot]];
[sectionElements addElement:[self createWebAndMapRoot]];
[sectionElements addElement:[self createTextRoot]];
[sectionElements addElement:[self createDateTimeRoot]];
[sectionElements addElement:[self createSortingRoot]];
[sectionElements addElement:[self createWithInitDefault]];
[sectionElements addElement:[self createWithInitAndKey]];
[root addSection:sectionSamples];
[root addSection:sectionElements];
if (objc_getClass("NSJSONSerialization")!=nil) {
QSection *sectionJson = [[QSection alloc] initWithTitle:@"JSON Samples"];
[sectionJson addElement:[[QRootElement alloc] initWithJSONFile:@"loginform"]];
[sectionJson addElement:[[QRootElement alloc] initWithJSONFile:@"sample"]];
[sectionJson addElement:[[QRootElement alloc] initWithJSONFile:@"jsondatasample"]];
[sectionJson addElement:[[QRootElement alloc] initWithJSONFile:@"jsonadvancedsample"]];
[root addSection:sectionJson];
}
return root;
}
@end