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

func

macrumors newbie
Original poster
Jul 6, 2009
6
0
Im trying to access the x and y positions of a view's origin (within a scrollview).

NSPoint p = [self visibleRect].origin;
NSLog(@"view's origin.x : %d", p.x);

If I inspect the first line in the debugger, the value of origin.x is set to some value > 0, depending on it's location. But the NSLog line will always print "view's origin.x : 0" .

What am I doing wrong here?
 
Thank you for the fast response!

Unfortunately it didnt solve the problem.
Now it outputs 0.00000 instead :(
 
What is "self" here? Is it the document view of the scroll view? If so you could try [[self enclosingScrollView] documentVisibleRect] and see if that gives anything different (might not). Also [self bounds] might be what you need.
 
Yeah, that solved it!

self was referring to a custom openGLView and not the documentaionView.

Thanks a lot!

edit: Im a nub ;)
 
Yeah, that solved it!

self was referring to a custom openGLView and not the documentaionView.

Thanks a lot!

edit: Im a nub ;)

Turn on as many warnings as possible. The compiler could have told you about the %d problem.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.