Re: Strange result with NSView's convertPoint:toView:
Re: Strange result with NSView's convertPoint:toView:
- Subject: Re: Strange result with NSView's convertPoint:toView:
- From: Ken Ferry <email@hidden>
- Date: Sat, 13 Nov 2010 18:54:19 -0800
Hi Eric,
I don't entirely follow this question, but I suspect I know what you're missing: the frame of a view is its location in the coordinate system of its superview. Its bounds is its location in its own coordinate system.
So this is okay
[superview convertRect:[view frame]...
And this is okay:
[view convertRect:[view bounds]...
But treating a view's frame as if it's in the coordinate system of itself is not alright.
-Ken
On Nov 12, 2010, at 8:47 AM, Eric Gorr <email@hidden> wrote:
> I have changed the contentView of my NSWindow to be a NSView which return YES for isFlipped.
>
> If I place a NSButton in the contentView of a window, I can do the following:
>
> NSRect r = [view frame];
> NSPoint origin;
>
> origin = [view convertPoint:NSZeroPoint toView:[[view window] contentView]];
>
> The r.origin will say something like ( 20, 14 ) and, when I convert the point, I get back what one would expect ( 20, 14 ).
>
> The problem comes when I try to place a NSImageView in that same content view.
>
> The r.origin will say something like ( 20, 14 ), but, when I convert the point, I get back ( 20, 78 ). (The NSImageView is 64x64)
>
> I am confused as to why this would be happening. Anyone have an idea?
>
> I should be able to easily provide some sample code if that is required in this case.
>
>
>
> _______________________________________________
>
> 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