AppDelegate.m 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. //
  2. // AppDelegate.m
  3. // AntsContract
  4. //
  5. // Created by Ray on 12/16/16.
  6. // Copyright © 2016 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "AppDelegate.h"
  9. #import "ACNetwork.h"
  10. #import "TextUtils.h"
  11. #import "PDFUtils.h"
  12. //#import "AFHTTPSessionManager.h"
  13. @interface AppDelegate ()
  14. @end
  15. @implementation AppDelegate
  16. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  17. // Override point for customization after application launch.
  18. self.bEnable_Cache = true;
  19. [self function_test];
  20. return YES;
  21. }
  22. -(void)function_test
  23. {
  24. return;
  25. printf("function test======================");
  26. // NSString* pdffile = [PDFUtils SavePDF:nil source:nil window_rect:CGRectMake(0, 0, 768, 960)];
  27. //[PDFUtils leak_test];
  28. [PDFUtils leak_test:nil source:nil window_rect:CGRectMake(0, 0, 768, 960)];
  29. // //获取路径
  30. //
  31. // NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//坐标
  32. //
  33. // NSString *saveDirectory=[paths objectAtIndex:0];
  34. //
  35. // NSString *saveFileName=[NSString stringWithFormat:@"%@.pdf",[[NSUUID UUID ] UUIDString] ] ;;
  36. //
  37. // NSString *newFilePath=[saveDirectory stringByAppendingPathComponent:saveFileName];
  38. //
  39. // const char *filename=[newFilePath UTF8String];
  40. //
  41. // NSLog(@"%@",newFilePath);
  42. // //设置页面大小 Letter纸
  43. //
  44. // //CGPDFDocumentGetMediaBox(document,1);
  45. // // CGPDFDictionaryRef pdf_dict= CGPDFDocumentGetInfo(document);
  46. //
  47. //
  48. //
  49. //
  50. //
  51. // //关联上下文的对象
  52. //
  53. //
  54. //
  55. // CFStringRef path;
  56. //
  57. // CFURLRef url;
  58. //
  59. // path=CFStringCreateWithCString(NULL, filename, kCFStringEncodingUTF8);
  60. //
  61. // url=CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, 0);
  62. //
  63. // CFBridgingRelease(path);
  64. // // CGPDFCONTEXTCREATE
  65. //
  66. //
  67. // CGContextRef pdfContext;
  68. // CGRect docsize = CGRectMake(0, 0, 612, 1008);
  69. //
  70. //
  71. // // NSDictionary *PDFAttributes =
  72. // // [NSDictionary dictionaryWithObjectsAndKeys:
  73. // // @"usai2010", (NSString *)kCGPDFContextOwnerPassword,
  74. // // kCFBooleanTrue, (NSString *)kCGPDFContextAllowsPrinting,
  75. // // kCFBooleanFalse, (NSString *)kCGPDFContextAllowsCopying,
  76. // // nil];
  77. // // // Create a descriptor.
  78. // // CFDictionaryRef cfpdfAttributes =(__bridge_retained CFDictionaryRef)PDFAttributes;
  79. //
  80. //
  81. // // CFBridgingRelease(cfpdfAttributes);
  82. //
  83. //
  84. //
  85. //
  86. // CFMutableDictionaryRef myDictionary = NULL;
  87. // myDictionary= CFDictionaryCreateMutable(NULL,
  88. // 0,
  89. // &kCFTypeDictionaryKeyCallBacks,
  90. // &kCFTypeDictionaryValueCallBacks);
  91. // // CFDictionarySetValue(myDictionary,
  92. // // kCGPDFContextTitle,
  93. // // CFSTR("Photo from iPrivate Album"));
  94. // // CFDictionarySetValue(myDictionary,
  95. // // kCGPDFContextCreator,
  96. // // CFSTR("iPrivate Album"));
  97. //
  98. // // //设置文档名称
  99. // // CFDictionarySetValue(myDictionary, kCGPDFContextTitle, CFSTR("My PDF File"));
  100. // // //设置创建者
  101. // // CFDictionarySetValue(myDictionary, kCGPDFContextCreator, CFSTR("My Name"));
  102. // //设置文档尺寸
  103. // CFDictionarySetValue(myDictionary, kCGPDFContextOwnerPassword, CFSTR("usai2010"));
  104. // CFDictionarySetValue(myDictionary, kCGPDFContextAllowsPrinting, kCFBooleanTrue);
  105. // CFDictionarySetValue(myDictionary, kCGPDFContextAllowsCopying, kCFBooleanFalse);
  106. //
  107. //
  108. //
  109. // pdfContext=CGPDFContextCreateWithURL(url, &docsize,NULL);
  110. //
  111. // CFRelease(myDictionary);
  112. // CFBridgingRelease(url);
  113. //
  114. //
  115. //
  116. //
  117. // CGContextRelease(pdfContext);
  118. return ;
  119. }
  120. - (void)applicationWillResignActive:(UIApplication *)application {
  121. // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
  122. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
  123. }
  124. - (void)applicationDidEnterBackground:(UIApplication *)application {
  125. // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
  126. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  127. }
  128. - (void)applicationWillEnterForeground:(UIApplication *)application {
  129. // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
  130. }
  131. - (void)applicationDidBecomeActive:(UIApplication *)application {
  132. // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
  133. }
  134. - (void)applicationWillTerminate:(UIApplication *)application {
  135. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  136. }
  137. -(void) Login:(NSString* )user pwd:(NSString*) pwd
  138. {
  139. self.user = user;
  140. self.password = pwd;
  141. self.bLogin = true;
  142. }
  143. -(void) Logout
  144. {
  145. // MainViewController * main_vc= (MainViewController*)self.main_vc;
  146. // [main_vc logoutOrder];
  147. //
  148. //
  149. // [main_vc hideMenu];
  150. // [main_vc switchToHome];
  151. self.user = nil;
  152. self.password=nil;
  153. self.bLogin = false;
  154. // self.user_icon=nil;
  155. // self.user_type = USER_ROLE_UNKNOWN;
  156. // self.bLogin = false;
  157. // self.contact_id=nil;
  158. // self.customerInfo = nil;
  159. // self.order_code = nil;
  160. //
  161. // [self.recent_model removeAllObjects];
  162. //
  163. // [self SetMode:nil];
  164. }
  165. @end