Re: Displaying an offset image. (Partial fix)
Re: Displaying an offset image. (Partial fix)
- Subject: Re: Displaying an offset image. (Partial fix)
- From: Mac First <email@hidden>
- Date: Thu, 11 Jun 2009 17:53:13 -0700
Ok, I took a stab at translateOriginToPoint earlier, but it didn't do
what I wanted, so I went down the path shown in my previous message,
below. I'm now back to using translateOriginToPoint, but...
CGPoint startPoint = CGPointMake(-300, 200);
[imageView translateOriginToPoint:NSPointFromCGPoint(startPoint)];
Only SORT of gives me what I want. For example, if I step through
with {-100, 0}, {-200, 0}, {-300, 0}, each translateOriginToPoint
behaves as if it's doing translateOriginByDistance. That is, the 1st
set moves me 100 over, then the next moves me 200 more (to show the
image at 300), then the next moves me 300 more (to show the image at
600), etc.
Is translateOriginToPoint broken? Do I just not understand its
intent? Is there some sort of "reset to 0,0" call?
NOTE:
[imageView translateOriginToPoint:NSPointFromCGPoint(CGPointZero)];
does *NOT* put things back to their starting position!
I'm getting close -- about what else do I need to know?
Thanks!
On Jun 11, 2009, at 5:32 PM, Mac First wrote:
I have a 500x500 image. It's really a 5x5 array of 100x100 image
tiles.
I have a 100x100 NSView, imageParentView.
I have a 500x500 NSImageView ("image well" in IB), "imageView" that
is a subview of imageParentView and which holds my image.
I'd like to display the 3rd tile in the 2nd row, so it shows through
imageParentView.
This code...
NSRect iviewFrame = [imageView frame];
iviewFrame.origin.x = 300;
iviewFrame.origin.y = 200;
[imageView setFrame:iviewFrame];
NSLog(@"frame origin: %0.1f, %0.1f", [imageView frame].origin.x,
[imageView frame].origin.y);
...Didn't do what I had hoped. (As far as I can tell, it moves my
parent view off-screen. I'm not 100% sure about that, but the
framing-view -- which I assume is imageParentView -- disappears.)
Am I close? Hints? Is there a tutorial for this?
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