• 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: Printing a View
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing a View


  • Subject: Re: Printing a View
  • From: Matt Neuburg <email@hidden>
  • Date: Mon, 13 Jul 2009 17:16:25 -0700
  • Thread-topic: Printing a View

On Mon, 13 Jul 2009 10:07:17 -0700, "K. Darcy Otto" <email@hidden> said:

>Now, this should simply print a line of integers down the left side of
>the page.  It does this for two pages - works perfectly - with lines 0
>to 50 on the first page, and 51 to 100 on the second page, divided
>correctly so there is no splitting of lines and so on. But the rest of
>the pages are blank, and I can't figure out why.  The NSLog from -

Again, you're not providing enough information, but here are some questions
to ask yourself.

* What's printing is a view. How tall is that view? Is it tall enough to
contain 500 lines?

* Also: In drawRect:(NSRect)rect, what is rect?

Those (and reading the docs) should lead to an "aha" moment...

Also you might like to search the archives. Printing is really easy and
you're making it hard for yourself, which is a pity. I've given some
possibly useful hints here:

http://www.cocoabuilder.com/archive/message/cocoa/2004/8/20/115128

http://www.cocoabuilder.com/archive/message/cocoa/2007/9/13/189212

http://www.cocoabuilder.com/archive/message/cocoa/2006/12/14/175913

http://www.cocoabuilder.com/archive/message/cocoa/2007/4/11/181739

I strongly suggest (as it says in one of those) that at first you completely
ignore pagination. Don't implement anything except drawRect! Just create the
view and draw it. Create it big enough for what needs to be drawn, and when
the system asks you draw what goes in a certain rect, draw what goes in that
rect. You will be amazed at how simple it all is. NOW you can start adding
finesse if you want to. By the way, if you are implementing rectForPage in
order to prevent lines from being split across pages, that is NOT how to do
it. See adjustPageHeightNew:.

m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



_______________________________________________

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

  • Follow-Ups:
    • Re: Printing a View [solved]
      • From: "K. Darcy Otto" <email@hidden>
  • Prev by Date: RE: literal strings - who do they belong to?
  • Next by Date: Saving NSArray of custom objects
  • Previous by thread: Re: Printing a View
  • Next by thread: Re: Printing a View [solved]
  • Index(es):
    • Date
    • Thread