• 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: Bug in NSImageView / NSPDFImageRep in Tiger?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in NSImageView / NSPDFImageRep in Tiger?


  • Subject: Re: Bug in NSImageView / NSPDFImageRep in Tiger?
  • From: Troy Stephens <email@hidden>
  • Date: Tue, 13 Sep 2005 14:57:01 -0700

There's a bug in NSImageCell's scaled image cache: The NSPDFImageRep's "currentPage" attribute used to be carried over when the NSImageCell made its rescaled copy, but on Tiger the current page number is reset to zero. (NSImageCell doesn't use the cached copy during window live resize, which is why you see the desired page instead of page zero when resizing the view.)

To work around this, you can either set the NSImageView to NSScaleNone, or, if you need scaling, you can subclass NSImageCell and override -drawInteriorWithFrame:inView: (or subclass NSImageView and override -drawRect:) to draw the view's content from the original image.

--
Troy Stephens
Cocoa Frameworks
Apple Computer, Inc.


On Sep 12, 2005, at 8:49 AM, Buddy Kurz wrote:
I'm having this problem as well - is there some solution?


On Jun 3, 2005, at 2:58 PM, Michael Heinz wrote:



I have an app that functions correctly in 10.3.x but has an odd behavior in 10.4.x.


The app processes multi-page PDF files and has an NSImageView to preview them. This view consistently displays the current page in 10.3.x, but in 10.4 it will only display the first page. What is weird is that if I set the current page to some number (say, 10) and resize the window, the correct page will be displayed - but if I then go to the next page (say, 11) the NSImageView displays the first page again!?!

Here's how I'm doing the image view. In the code fragment, "documentRep" is the NSPDFImageRep, "document" is the NSImage it belongs to and "myView" is the NSImageView.

[myView setImage:document];
.
.
.
[documentRep setCurrentPage:pageNumber];
[document recache];

As I mention, this behaves as expected in 10.3.x. I have also tried the following approach:

[document release];
[documentRep setCurrentPage:pageNumber];
[documentRep recache];
document = [[NSImage alloc] init];
[document addRepresentation:documentRep];
[myView setImage:document];

This code behaves the same as the first snippet.

I've googled around and everything I've found says that these methods should work. Am I missing something? The fact that it displays the correct page during/after a resize but then jumps back to the first page the next time I call setCurrentPage is just weird...

If anyone wants to see the effect, you can download the app at http://prdownloads.sourceforge.net/pdf2psp/PDF2PSP.app.sitx?download


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Bug in NSImageView / NSPDFImageRep in Tiger? (From: Buddy Kurz <email@hidden>)

  • Prev by Date: Disabling Display of JPG and PDF Files in NSTextView
  • Next by Date: Adding hit test to circleview question.
  • Previous by thread: Re: Bug in NSImageView / NSPDFImageRep in Tiger?
  • Next by thread: 10.4 NSDateFormatter format strings
  • Index(es):
    • Date
    • Thread