Skip to main content

Posts

Showing posts from February, 2011

Write PDF in the Document Directory

NSString *urlString = @"http://www.web.com/url/for/document.pdf"; NSURL *url = [NSURL URLWithString:urlString]; NSData *data = [NSData dataWithContentsOfURL:url]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *pdfPath = [documentsDirectory stringByAppendingPathComponent:@"myLocalFileName.pdf"]; [data writeToFile:pdfPath atomically:YES];

Add Loader in The application

-( UIView *)initLoader { UIView *indicatiorView = [[ UIView alloc ] initWithFrame : CGRectMake ( 0 , 0 , 320 , 480 )]; indicatiorView. backgroundColor = [ UIColor clearColor ]; indicatiorView. alpha = 0.8 ; UIView *blackView=[[ UIView alloc ] initWithFrame : CGRectMake ( 85 , 200 , 150 , 60 )]; blackView. backgroundColor =[ UIColor blackColor ]; blackView. layer . cornerRadius = 10 ; UILabel *reloadingLabel=[[ UILabel alloc ] initWithFrame : CGRectMake ( 0 , 0 , 150 , 25 )]; reloadingLabel. text = @"Please Wait..." ; reloadingLabel. textAlignment = UITextAlignmentCenter ; reloadingLabel. textColor =[ UIColor whiteColor ]; reloadingLabel. font =[ UIFont boldSystemFontOfSize : 16 ]; reloadingLabel. backgroundColor =[ UIColor clearColor ]; [blackView addSubview :reloadingLabel]; [reloadingLabel release ]; UIActivityIndicatorView *indicatorView = [[ UIActivityIndicatorView alloc ] initWithFrame : CGRectMake ( 65 , 30 , 22 , 22 )]; indicatorView. a