Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-21-2010, 04:28 AM   #1 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 31
Zala is on a distinguished road
Default Question on some codes (PDF Viewer)

Code:
// Create an instance of PDFViewController
	PDF *pdfView = [[PDF alloc] initWithNibName:@"PDF" bundle:nil];
	
	// Get the path to our documents directory
	NSArray *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	
	// This should be our documents directory
	NSString *saveDirectory = [documentPath objectAtIndex:0];
	
	// Our PDF is named 'Example.pdf'
	NSString *saveFileName = @"example.pdf";
	
	// Create the full path using our saveDirectory and saveFileName
	NSString *finalPath = [saveDirectory stringByAppendingPathComponent:saveFileName];
	
	// Set the pdfUrl to our finalPath
	pdfView.pdfUrl = [NSURL fileURLWithPath:finalPath];
	
	// Push 'controller'
	[self.navigationController pushViewController:pdfView animated:YES];
	
	// Release 'controller'
	[pdfView release];
I am trying to understand this part of the code.

As far as i know i do not see where can i set the values of the "documentPath" and "saveDirectory".

example a "finalpath" should be " c:/Users/a/Desktop/example.pdf"

from my little knowledge i should be able to set to the variable "saveDirectory". But i just do not know how.

Anyone can shed some light?

*yes even with the comments i am so weak

Last edited by Zala; 06-21-2010 at 04:31 AM.
Zala is offline   Reply With Quote
Old 06-22-2010, 01:01 AM   #2 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 31
Zala is on a distinguished road
Default

bump for anyone who can help
Zala is offline   Reply With Quote
Old 06-23-2010, 09:12 AM   #3 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 4
asifali is on a distinguished road
Default

Quote:
Originally Posted by Zala View Post
Code:
// Create an instance of PDFViewController
	PDF *pdfView = [[PDF alloc] initWithNibName:@"PDF" bundle:nil];
	
	// Get the path to our documents directory
	NSArray *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	
	// This should be our documents directory
	NSString *saveDirectory = [documentPath objectAtIndex:0];
	
	// Our PDF is named 'Example.pdf'
	NSString *saveFileName = @"example.pdf";
	
	// Create the full path using our saveDirectory and saveFileName
	NSString *finalPath = [saveDirectory stringByAppendingPathComponent:saveFileName];
	
	// Set the pdfUrl to our finalPath
	pdfView.pdfUrl = [NSURL fileURLWithPath:finalPath];
	
	// Push 'controller'
	[self.navigationController pushViewController:pdfView animated:YES];
	
	// Release 'controller'
	[pdfView release];
I am trying to understand this part of the code.

As far as i know i do not see where can i set the values of the "documentPath" and "saveDirectory".

example a "finalpath" should be " c:/Users/a/Desktop/example.pdf"

from my little knowledge i should be able to set to the variable "saveDirectory". But i just do not know how.

Anyone can shed some light?

*yes even with the comments i am so weak

use this to find the path NSLog(fianlpath);
asifali is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 466
14 members and 452 guests
7twenty7, AlanFloyd, David-T, imac74, Jaxen66, logan, lovoyl, Music Man, mutantskin, Sami Gh, SLIC, solardrift, unicornleo, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,683
Threads: 94,131
Posts: 402,932
Top Poster: BrianSlick (7,990)
Welcome to our newest member, unicornleo
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:09 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0