• 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: Image Alignment In Scrolled View?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Image Alignment In Scrolled View?


  • Subject: Re: Image Alignment In Scrolled View?
  • From: John Pannell <email@hidden>
  • Date: Mon, 14 Jun 2004 21:35:58 -0600

Hi Jerry-

1) The most trivial of my problems is that small images load into
the lower left corner of the image view...
I have in the code: [theImageView setImageAlignment: NSImageAlignTopLeft];
but it or any other choice for alignment seems to have no effect.

To get your image to appear in the upper left, you can subclass your image view to return YES to the isFlipped message. In Cocoa, the coordinate system uses the lower left as the origin, not the upper left. If the image view "isFlipped", it considers the upper left to be the origin.

2) Manually changing the window size seems to screw up the scrolling...
Don't have a clue here ;(

My guess here is look at your setup in IB. You want to make sure the scroll view is springy inside and fixed outside to stretch with the window (if that is your desired behavior), and that the image view (which is a subview of the scroll view) is not springy inside or out.

3) this code
NSLog(@"ScaledImage release cnt(2):%d",[tmpImage retainCount]);
[theImageView setImage:tmpImage];
NSLog(@"ScaledImage release cnt(3):%d",[tmpImage retainCount]);

generates a log file like:
2004-06-14 19:30:53.395 SimpleImage[8274] ScaledImage release cnt(2):1
2004-06-14 19:30:53.396 SimpleImage[8274] ScaledImage release cnt(3):3

Weird. No ideas here, but I've never tried to check such a thing.

Some code is worth a thousand email replies :-). I have two subclasses (of NSImageView and NSScrollView) I have written to work together to provide a scroll view that scales the contained image with a little control incorporated into the scroll view. Please feel free to check it out:

http://www.positivespinmedia.com/ScaleScroll.zip

I have an app that uses these (called NetScrape, on my site) should you want to see it in action.

Hope this helps!

John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Image Alignment In Scrolled View? (From: Jerry LeVan <email@hidden>)

  • Prev by Date: Re: Allocation in Pools and threads
  • Next by Date: Re: Does any one know how to get a running processes id?
  • Previous by thread: Image Alignment In Scrolled View?
  • Next by thread: Re: Image Alignment In Scrolled View?
  • Index(es):
    • Date
    • Thread