|
@@ -722,145 +722,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark verify data
|
|
#pragma mark verify data
|
|
|
-- (UIView *)createDemoView:(NSString*) msg
|
|
|
|
|
-{
|
|
|
|
|
- UIView *demoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 290, 200)];
|
|
|
|
|
-
|
|
|
|
|
- // UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 270, 180)];
|
|
|
|
|
- // [imageView setImage:[UIImage imageNamed:@"demo"]];
|
|
|
|
|
-
|
|
|
|
|
- UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 270, 10)];
|
|
|
|
|
- titleLabel.font = [UIFont boldSystemFontOfSize:20];
|
|
|
|
|
- titleLabel.text=@"Missing fields:";
|
|
|
|
|
- titleLabel.numberOfLines = 0;
|
|
|
|
|
- titleLabel.lineBreakMode =NSLineBreakByWordWrapping;
|
|
|
|
|
- // titleLabel.textAlignment = NSTextAlignmentRight;
|
|
|
|
|
- titleLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
|
|
- CGSize constraintkey = CGSizeMake(270, 20000.0f);//key label width is 40% cell width;
|
|
|
|
|
- CGSize sizetitle = [@"Missing fields:" sizeWithFont:[UIFont systemFontOfSize:20.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
|
|
|
|
|
-
|
|
|
|
|
- //[titleLabel sizeToFit];
|
|
|
|
|
- // titleLabel.center.x = demoView.center.x;
|
|
|
|
|
- titleLabel.frame = CGRectMake(10, 10, 270, sizetitle.height);
|
|
|
|
|
- [demoView addSubview:titleLabel];
|
|
|
|
|
-
|
|
|
|
|
- UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, titleLabel.frame.origin.y+ titleLabel.frame.size.height+20, 260, 10)];
|
|
|
|
|
- lineLabel.font = [UIFont boldSystemFontOfSize:17];
|
|
|
|
|
- lineLabel.text=msg;
|
|
|
|
|
- lineLabel.numberOfLines = 0;
|
|
|
|
|
- lineLabel.lineBreakMode =NSLineBreakByWordWrapping;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- constraintkey = CGSizeMake(260, 20000.0f);
|
|
|
|
|
- CGSize sizemsg = [msg sizeWithFont:[UIFont boldSystemFontOfSize:17.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
|
|
|
|
|
-
|
|
|
|
|
- lineLabel.frame = CGRectMake(15, titleLabel.frame.origin.y+ titleLabel.frame.size.height+20, 260, sizemsg.height);
|
|
|
|
|
- //[lineLabel sizeToFit];
|
|
|
|
|
-
|
|
|
|
|
- [demoView addSubview:lineLabel];
|
|
|
|
|
- demoView.frame = CGRectMake(0, 0, 290, lineLabel.frame.origin.y+lineLabel.frame.size.height+25);
|
|
|
|
|
- return demoView;
|
|
|
|
|
-}
|
|
|
|
|
--(bool) verifyData
|
|
|
|
|
-{
|
|
|
|
|
-
|
|
|
|
|
- if(NO_SAVE_VERIFY)
|
|
|
|
|
- return true;
|
|
|
|
|
- // return true;
|
|
|
|
|
- bool ret=true;
|
|
|
|
|
- int more=0;
|
|
|
|
|
- NSMutableArray* fields=[[NSMutableArray alloc] init];
|
|
|
|
|
-
|
|
|
|
|
- for(int i=0;i<[self.controlTemplate[@"count"] intValue];i++)
|
|
|
|
|
- {
|
|
|
|
|
- NSMutableDictionary* page =self.controlTemplate[[NSString stringWithFormat:@"page_%d",i]];
|
|
|
|
|
- for(int j=0;j<[page[@"count"] intValue];j++)
|
|
|
|
|
- {
|
|
|
|
|
- NSMutableDictionary* control =page[[NSString stringWithFormat:@"control_%d",j]];
|
|
|
|
|
- NSString* type = control[@"type"];
|
|
|
|
|
- NSString* name = control[@"aname"];
|
|
|
|
|
- bool required = [control[@"required"] boolValue];
|
|
|
|
|
-
|
|
|
|
|
- if(required==false || [type.lowercaseString isEqualToString:@"ignor"])
|
|
|
|
|
- continue;
|
|
|
|
|
- if([type isEqualToString:@"Check"])
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr = control[@"value"];
|
|
|
|
|
- if(arr.count==0)
|
|
|
|
|
- {
|
|
|
|
|
- ret=false;
|
|
|
|
|
-
|
|
|
|
|
- NSString* msg=[NSString stringWithFormat:@"%u. Page %d: %@",fields.count+1,i+1,name];
|
|
|
|
|
- if(fields.count<15)
|
|
|
|
|
- [fields addObject:msg];
|
|
|
|
|
- else
|
|
|
|
|
- more++;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else if(/*[type isEqualToString:@"Signature"]||*/[type isEqualToString:@"Image"]||[type isEqualToString:@"Label"])
|
|
|
|
|
- {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSString* str = control[@"value"];
|
|
|
|
|
- if(str.length==0)
|
|
|
|
|
- {
|
|
|
|
|
- ret=false;
|
|
|
|
|
- NSString* msg=[NSString stringWithFormat:@"%lu. Page %d: %@",fields.count+1,i+1,name];
|
|
|
|
|
- if(fields.count<15)
|
|
|
|
|
- [fields addObject:msg];
|
|
|
|
|
- else
|
|
|
|
|
- more++;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if(ret==false)
|
|
|
|
|
- {
|
|
|
|
|
- if(more>0)
|
|
|
|
|
- {
|
|
|
|
|
- NSString* msg=[NSString stringWithFormat:@"And %d more missing fields.",more];
|
|
|
|
|
-
|
|
|
|
|
- [fields addObject:@"......"];
|
|
|
|
|
- [fields addObject:msg];
|
|
|
|
|
- }
|
|
|
|
|
- NSString* missfields=[fields componentsJoinedByString:@"\n"];
|
|
|
|
|
- NSString* msg = [NSString stringWithFormat:@"%@",missfields];
|
|
|
|
|
-
|
|
|
|
|
- CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // Add some custom content to the alert view
|
|
|
|
|
- [alertView setContainerView:[self createDemoView:msg]];
|
|
|
|
|
-
|
|
|
|
|
- // Modify the parameters
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- [alertView setButtonTitles:[NSMutableArray arrayWithObjects:@"OK", nil]];
|
|
|
|
|
- //[alertView setDelegate:self];
|
|
|
|
|
-
|
|
|
|
|
- // You may use a Block, rather than a delegate.
|
|
|
|
|
- [alertView setOnButtonTouchUpInside:^(CustomIOSAlertView *alertView, int buttonIndex) {
|
|
|
|
|
- // DebugLog(@"Block: Button at position %d is clicked on alertView %d.", buttonIndex, (int)[alertView tag]);
|
|
|
|
|
- [alertView close];
|
|
|
|
|
- }];
|
|
|
|
|
-
|
|
|
|
|
- // [alertView setUseMotionEffects:true];
|
|
|
|
|
-
|
|
|
|
|
- // And launch the dialog
|
|
|
|
|
-
|
|
|
|
|
- [alertView sizeToFit];
|
|
|
|
|
- [alertView show];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- return ret;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+//- (UIView *)createDemoView:(NSString*) msg
|
|
|
|
|
+//{
|
|
|
|
|
+// UIView *demoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 290, 200)];
|
|
|
|
|
+//
|
|
|
|
|
+// // UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 270, 180)];
|
|
|
|
|
+// // [imageView setImage:[UIImage imageNamed:@"demo"]];
|
|
|
|
|
+//
|
|
|
|
|
+// UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 270, 10)];
|
|
|
|
|
+// titleLabel.font = [UIFont boldSystemFontOfSize:20];
|
|
|
|
|
+// titleLabel.text=@"Missing fields:";
|
|
|
|
|
+// titleLabel.numberOfLines = 0;
|
|
|
|
|
+// titleLabel.lineBreakMode =NSLineBreakByWordWrapping;
|
|
|
|
|
+// // titleLabel.textAlignment = NSTextAlignmentRight;
|
|
|
|
|
+// titleLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
|
|
+// CGSize constraintkey = CGSizeMake(270, 20000.0f);//key label width is 40% cell width;
|
|
|
|
|
+//// CGSize sizetitle1 = [@"Missing fields:" sizeWithFont:[UIFont systemFontOfSize:20.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// CGSize sizetitle = [@"Missing fields:" boundingRectWithSize:constraintkey
|
|
|
|
|
+// options:NSStringDrawingUsesLineFragmentOrigin| NSStringDrawingUsesFontLeading
|
|
|
|
|
+// attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20.0]}
|
|
|
|
|
+// context:nil].size;
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// //[titleLabel sizeToFit];
|
|
|
|
|
+// // titleLabel.center.x = demoView.center.x;
|
|
|
|
|
+// titleLabel.frame = CGRectMake(10, 10, 270, sizetitle.height);
|
|
|
|
|
+// [demoView addSubview:titleLabel];
|
|
|
|
|
+//
|
|
|
|
|
+// UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, titleLabel.frame.origin.y+ titleLabel.frame.size.height+20, 260, 10)];
|
|
|
|
|
+// lineLabel.font = [UIFont boldSystemFontOfSize:17];
|
|
|
|
|
+// lineLabel.text=msg;
|
|
|
|
|
+// lineLabel.numberOfLines = 0;
|
|
|
|
|
+// lineLabel.lineBreakMode =NSLineBreakByWordWrapping;
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// constraintkey = CGSizeMake(260, 20000.0f);
|
|
|
|
|
+// CGSize sizemsg1 = [msg sizeWithFont:[UIFont boldSystemFontOfSize:17.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// CGSize sizemsg = [msg boundingRectWithSize:constraintkey
|
|
|
|
|
+// options:NSStringDrawingUsesLineFragmentOrigin| NSStringDrawingUsesFontLeading
|
|
|
|
|
+// attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17.0]}
|
|
|
|
|
+// context:nil].size;
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// lineLabel.frame = CGRectMake(15, titleLabel.frame.origin.y+ titleLabel.frame.size.height+20, 260, sizemsg.height);
|
|
|
|
|
+// //[lineLabel sizeToFit];
|
|
|
|
|
+//
|
|
|
|
|
+// [demoView addSubview:lineLabel];
|
|
|
|
|
+// demoView.frame = CGRectMake(0, 0, 290, lineLabel.frame.origin.y+lineLabel.frame.size.height+25);
|
|
|
|
|
+// return demoView;
|
|
|
|
|
+//}
|
|
|
|
|
+//-(bool) verifyData
|
|
|
|
|
+//{
|
|
|
|
|
+//
|
|
|
|
|
+// if(NO_SAVE_VERIFY)
|
|
|
|
|
+// return true;
|
|
|
|
|
+// // return true;
|
|
|
|
|
+// bool ret=true;
|
|
|
|
|
+// int more=0;
|
|
|
|
|
+// NSMutableArray* fields=[[NSMutableArray alloc] init];
|
|
|
|
|
+//
|
|
|
|
|
+// for(int i=0;i<[self.controlTemplate[@"count"] intValue];i++)
|
|
|
|
|
+// {
|
|
|
|
|
+// NSMutableDictionary* page =self.controlTemplate[[NSString stringWithFormat:@"page_%d",i]];
|
|
|
|
|
+// for(int j=0;j<[page[@"count"] intValue];j++)
|
|
|
|
|
+// {
|
|
|
|
|
+// NSMutableDictionary* control =page[[NSString stringWithFormat:@"control_%d",j]];
|
|
|
|
|
+// NSString* type = control[@"type"];
|
|
|
|
|
+// NSString* name = control[@"aname"];
|
|
|
|
|
+// bool required = [control[@"required"] boolValue];
|
|
|
|
|
+//
|
|
|
|
|
+// if(required==false || [type.lowercaseString isEqualToString:@"ignor"])
|
|
|
|
|
+// continue;
|
|
|
|
|
+// if([type isEqualToString:@"Check"])
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr = control[@"value"];
|
|
|
|
|
+// if(arr.count==0)
|
|
|
|
|
+// {
|
|
|
|
|
+// ret=false;
|
|
|
|
|
+//
|
|
|
|
|
+// NSString* msg=[NSString stringWithFormat:@"%u. Page %d: %@",fields.count+1,i+1,name];
|
|
|
|
|
+// if(fields.count<15)
|
|
|
|
|
+// [fields addObject:msg];
|
|
|
|
|
+// else
|
|
|
|
|
+// more++;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// else if(/*[type isEqualToString:@"Signature"]||*/[type isEqualToString:@"Image"]||[type isEqualToString:@"Label"])
|
|
|
|
|
+// {
|
|
|
|
|
+// continue;
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSString* str = control[@"value"];
|
|
|
|
|
+// if(str.length==0)
|
|
|
|
|
+// {
|
|
|
|
|
+// ret=false;
|
|
|
|
|
+// NSString* msg=[NSString stringWithFormat:@"%lu. Page %d: %@",fields.count+1,i+1,name];
|
|
|
|
|
+// if(fields.count<15)
|
|
|
|
|
+// [fields addObject:msg];
|
|
|
|
|
+// else
|
|
|
|
|
+// more++;
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// if(ret==false)
|
|
|
|
|
+// {
|
|
|
|
|
+// if(more>0)
|
|
|
|
|
+// {
|
|
|
|
|
+// NSString* msg=[NSString stringWithFormat:@"And %d more missing fields.",more];
|
|
|
|
|
+//
|
|
|
|
|
+// [fields addObject:@"......"];
|
|
|
|
|
+// [fields addObject:msg];
|
|
|
|
|
+// }
|
|
|
|
|
+// NSString* missfields=[fields componentsJoinedByString:@"\n"];
|
|
|
|
|
+// NSString* msg = [NSString stringWithFormat:@"%@",missfields];
|
|
|
|
|
+//
|
|
|
|
|
+// CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// // Add some custom content to the alert view
|
|
|
|
|
+// [alertView setContainerView:[self createDemoView:msg]];
|
|
|
|
|
+//
|
|
|
|
|
+// // Modify the parameters
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// [alertView setButtonTitles:[NSMutableArray arrayWithObjects:@"OK", nil]];
|
|
|
|
|
+// //[alertView setDelegate:self];
|
|
|
|
|
+//
|
|
|
|
|
+// // You may use a Block, rather than a delegate.
|
|
|
|
|
+// [alertView setOnButtonTouchUpInside:^(CustomIOSAlertView *alertView, int buttonIndex) {
|
|
|
|
|
+// // DebugLog(@"Block: Button at position %d is clicked on alertView %d.", buttonIndex, (int)[alertView tag]);
|
|
|
|
|
+// [alertView close];
|
|
|
|
|
+// }];
|
|
|
|
|
+//
|
|
|
|
|
+// // [alertView setUseMotionEffects:true];
|
|
|
|
|
+//
|
|
|
|
|
+// // And launch the dialog
|
|
|
|
|
+//
|
|
|
|
|
+// [alertView sizeToFit];
|
|
|
|
|
+// [alertView show];
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// return ret;
|
|
|
|
|
+//}
|
|
|
|
|
|
|
|
#pragma mark - Page View Controller Data Source
|
|
#pragma mark - Page View Controller Data Source
|
|
|
|
|
|