• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cannot get PDF document show up in PDFView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cannot get PDF document show up in PDFView


  • Subject: Re: Cannot get PDF document show up in PDFView
  • From: "Mike R. Manzano" <email@hidden>
  • Date: Tue, 15 Apr 2008 08:20:55 -0700

Look up -awakeFromNib.

// Called when
@implementation MyPDFView

[...]

// Called when this view is loaded from the nib
- (void) awakeFromNib
{
myDoc = [[[PDFDocument alloc] initWithURL: [ NSURL fileURLWithPath:@"Users/raj/Desktop/ObjectiveC.pdf"]] autorelease];


[self setDocument: myDoc];}
}

[...]

@end

A few comments: you don't need the (NSURL *) and (NSString *) casts. As with C, you only need to cast if the value you're passing in has a different type than expected by the method signature. NSStrings start with an '@". This looks like "learning" code, but in a real program, you probably wouldn't hard-code a path like that.

Cheers,

Mike


On Apr 15, 2008, at 4:57 AM, Rajeshwari Iyer wrote:

Hi,

I am a beginner with cocoa and am making an application where i want to display a PDF file in my app. window. I have subclassed PDFView to myPDFView and have attached a PDF view from interface builder to my window..... Now how do i associate the PDF document that i want to display with this view? I came across this 2 line code to do this...

myDoc = [[[PDFDocument alloc] initWithURL: (NSURL *) [ NSURL fileURLWithPath: (NSString *)"Users/raj/Desktop/ObjectiveC.pdf"]] autorelease];

[pdfView setDocument: myDoc];

but i cannot understand where to add this in my sub class....

can somebody please help?

THANKS!

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Cannot get PDF document show up in PDFView (From: Rajeshwari Iyer <email@hidden>)

  • Prev by Date: Re: is this badly written code?
  • Next by Date: Re: App fails to kill NSTask processes
  • Previous by thread: Cannot get PDF document show up in PDFView
  • Next by thread: [ANN] Port mapping/forwarding framework (MIT license)
  • Index(es):
    • Date
    • Thread