| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- //
- // AppDelegate.m
- // AntsContract
- //
- // Created by Ray on 12/16/16.
- // Copyright © 2016 United Software Applications, Inc. All rights reserved.
- //
- #import "AppDelegate.h"
- #import "ACNetwork.h"
- #import "TextUtils.h"
- #import "PDFUtils.h"
- //#import "AFHTTPSessionManager.h"
- @interface AppDelegate ()
- @end
- @implementation AppDelegate
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- // Override point for customization after application launch.
-
- self.bEnable_Cache = true;
-
-
- [self function_test];
- return YES;
- }
- -(void)function_test
- {
- return;
-
- printf("function test======================");
- // NSString* pdffile = [PDFUtils SavePDF:nil source:nil window_rect:CGRectMake(0, 0, 768, 960)];
- // [PDFUtils leak_test];
-
- // 获取路径
-
- NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//坐标
-
- NSString *saveDirectory=[paths objectAtIndex:0];
-
- NSString *saveFileName=[NSString stringWithFormat:@"%@.pdf",[[NSUUID UUID ] UUIDString] ] ;;
-
- NSString *newFilePath=[saveDirectory stringByAppendingPathComponent:saveFileName];
-
- const char *filename=[newFilePath UTF8String];
-
- NSLog(@"%@",newFilePath);
- //设置页面大小 Letter纸
-
-
-
- CFStringRef path;
-
- CFURLRef url;
-
- path=CFStringCreateWithCString(NULL, filename, kCFStringEncodingUTF8);
-
- url=CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, 0);
-
- CFRelease(path);
- // CGPDFCONTEXTCREATE
-
-
- CGContextRef pdfContext;
- CGRect docsize = CGRectMake(0, 0, 612, 1008);
-
-
- CFMutableDictionaryRef myDictionary = NULL;
- myDictionary= CFDictionaryCreateMutable(NULL,
- 0,
- NULL,
- NULL);
- CFDictionarySetValue(myDictionary, kCGPDFContextOwnerPassword, CFSTR("usai2010"));
- CFDictionarySetValue(myDictionary, kCGPDFContextAllowsPrinting, kCFBooleanTrue);
- CFDictionarySetValue(myDictionary, kCGPDFContextAllowsCopying, kCFBooleanFalse);
-
-
-
- pdfContext=CGPDFContextCreateWithURL(url, &docsize,myDictionary);
-
- CFRelease(myDictionary);
- CFRelease(url);
- CGContextBeginPage(pdfContext, &docsize);
- // cgpdfpage
-
- CGContextEndPage(pdfContext);
-
- CGPDFContextClose(pdfContext);
- CGContextRelease(pdfContext);
-
-
- return ;
-
- }
- - (void)applicationWillResignActive:(UIApplication *)application {
- // 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.
- // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
- }
- - (void)applicationDidEnterBackground:(UIApplication *)application {
- // 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.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
- }
- - (void)applicationWillEnterForeground:(UIApplication *)application {
- // 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.
- }
- - (void)applicationDidBecomeActive:(UIApplication *)application {
- // 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.
- }
- - (void)applicationWillTerminate:(UIApplication *)application {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- }
- -(void) Login:(NSString* )user pwd:(NSString*) pwd
- {
- self.user = user;
- self.password = pwd;
- self.bLogin = true;
- }
- -(void) Logout
- {
- // MainViewController * main_vc= (MainViewController*)self.main_vc;
- // [main_vc logoutOrder];
- //
- //
- // [main_vc hideMenu];
- // [main_vc switchToHome];
- self.user = nil;
- self.password=nil;
- self.bLogin = false;
-
-
- // self.user_icon=nil;
- // self.user_type = USER_ROLE_UNKNOWN;
- // self.bLogin = false;
- // self.contact_id=nil;
- // self.customerInfo = nil;
- // self.order_code = nil;
- //
- // [self.recent_model removeAllObjects];
- //
- // [self SetMode:nil];
-
- }
- @end
|