Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

John Baughman

macrumors regular
Original poster
Oct 27, 2003
100
0
in the SetImage mthod we added...

Code:
downPoint = NSZeroPoint;
currentPoint.x = downPoint.x + imageSize.width;
currentPoint.y = downPoint.y + imageSize.height;

Why do we add the width and height to downPoint x and y. downPoint will always be 0/0 so why to why can't you just apply the width and size directly...

Code:
downPoint = NSZeroPoint;
currentPoint.x = imageSize.width;
currentPoint.y = imageSize.height;

Problem: For some reason I cannot get currentPoint.x to be anything but zero. currntPoint.y gets a value but not currentPoint.x. Result is the image cannot be seen when it is opened. Clicking anywhere immediately makes it visible as a straight vertical line, then you can resize it. The width of my image is 128, so I tried assigning 128 directly and it still does not work.

Thanks for any help.

John

OK, I am wrong. currentPointer.x is getting the set. I was using NSLog to look at the value being set and apparently not doing that correctly. I can see it being set properly to 128 in the debugger.

Now the question is why doesn't the picture display when first opened?

I found the bug. I had the height parameter of NSmakeRect maxY=minY instead of maxY-minY.

Still curious as to why we are adding the height and width of the image to zero to set the points of the current rectangle.
 
I found the bug. I had the height parameter of NSmakeRect maxY=minY instead of maxY-minY.

Still curious as to why we are adding the height and width of the image to zero to set the points of the current rectangle.

Would that be the line the author tells you to double check because many people mistype it? I just did that exercise last night and wondered about his comment.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.