AppDelegate.m 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. //获取路径
  29. //
  30. // NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//坐标
  31. //
  32. // NSString *saveDirectory=[paths objectAtIndex:0];
  33. //
  34. // NSString *saveFileName=[NSString stringWithFormat:@"%@.pdf",[[NSUUID UUID ] UUIDString] ] ;;
  35. //
  36. // NSString *newFilePath=[saveDirectory stringByAppendingPathComponent:saveFileName];
  37. //
  38. // const char *filename=[newFilePath UTF8String];
  39. //
  40. // NSLog(@"%@",newFilePath);
  41. // //设置页面大小 Letter纸
  42. //
  43. //
  44. //
  45. //
  46. // CFStringRef path;
  47. //
  48. // CFURLRef url;
  49. //
  50. // path=CFStringCreateWithCString(NULL, filename, kCFStringEncodingUTF8);
  51. //
  52. // url=CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, 0);
  53. //
  54. // CFBridgingRelease(path);
  55. // // CGPDFCONTEXTCREATE
  56. //
  57. //
  58. // CGContextRef pdfContext;
  59. // CGRect docsize = CGRectMake(0, 0, 612, 1008);
  60. //
  61. //
  62. // CFMutableDictionaryRef myDictionary = NULL;
  63. // myDictionary= CFDictionaryCreateMutable(NULL,
  64. // 0,
  65. // &kCFTypeDictionaryKeyCallBacks,
  66. // &kCFTypeDictionaryValueCallBacks);
  67. //
  68. // CFDictionarySetValue(myDictionary, kCGPDFContextOwnerPassword, CFSTR("usai2010"));
  69. // CFDictionarySetValue(myDictionary, kCGPDFContextAllowsPrinting, kCFBooleanTrue);
  70. // CFDictionarySetValue(myDictionary, kCGPDFContextAllowsCopying, kCFBooleanFalse);
  71. //
  72. //
  73. //
  74. // pdfContext=CGPDFContextCreateWithURL(url, &docsize,myDictionary);
  75. //
  76. // CFRelease(myDictionary);
  77. // CFBridgingRelease(url);
  78. //
  79. //
  80. //
  81. //
  82. // CGContextRelease(pdfContext);
  83. //
  84. //
  85. return ;
  86. }
  87. - (void)applicationWillResignActive:(UIApplication *)application {
  88. // 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.
  89. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
  90. }
  91. - (void)applicationDidEnterBackground:(UIApplication *)application {
  92. // 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.
  93. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  94. }
  95. - (void)applicationWillEnterForeground:(UIApplication *)application {
  96. // 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.
  97. }
  98. - (void)applicationDidBecomeActive:(UIApplication *)application {
  99. // 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.
  100. }
  101. - (void)applicationWillTerminate:(UIApplication *)application {
  102. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  103. }
  104. -(void) Login:(NSString* )user pwd:(NSString*) pwd
  105. {
  106. self.user = user;
  107. self.password = pwd;
  108. self.bLogin = true;
  109. }
  110. -(void) Logout
  111. {
  112. // MainViewController * main_vc= (MainViewController*)self.main_vc;
  113. // [main_vc logoutOrder];
  114. //
  115. //
  116. // [main_vc hideMenu];
  117. // [main_vc switchToHome];
  118. self.user = nil;
  119. self.password=nil;
  120. self.bLogin = false;
  121. // self.user_icon=nil;
  122. // self.user_type = USER_ROLE_UNKNOWN;
  123. // self.bLogin = false;
  124. // self.contact_id=nil;
  125. // self.customerInfo = nil;
  126. // self.order_code = nil;
  127. //
  128. // [self.recent_model removeAllObjects];
  129. //
  130. // [self SetMode:nil];
  131. }
  132. @end