Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 22, 2008, 06:27 PM   #1
john903
macrumors member
 
Join Date: Apr 2008
UIScrollView - position of scroll bars

Is there a way to get the position of the scroll bars in a UIScrollView?
john903 is offline   0 Reply With Quote
Old Sep 22, 2008, 06:35 PM   #2
Niiro13
macrumors 68000
 
Join Date: Feb 2008
Location: Illinois
Send a message via AIM to Niiro13 Send a message via MSN to Niiro13 Send a message via Yahoo to Niiro13
Not that I know of.

But the scrollers to screen should be the same relation as the center of the scrollview is to its content.
Niiro13 is offline   0 Reply With Quote
Old Sep 22, 2008, 06:55 PM   #3
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
There are no scroll bars in a scrollview. I think what you want are contentOffset and setContentOffset:
PhoneyDeveloper is offline   0 Reply With Quote
Old Sep 22, 2008, 07:28 PM   #4
john903
Thread Starter
macrumors member
 
Join Date: Apr 2008
Yes. That's what I want! I'm trying to find this out in the scrollViewDidScroll method in my UIScrollViewDelegate. I did this but point returned is always {0,0}. Do you know what I'm doing wrong? Thanks!

Code:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
	CGPoint point = [scrollView contentOffset];
}
john903 is offline   0 Reply With Quote
Old Sep 22, 2008, 08:07 PM   #5
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Don't know what you're doing wrong. How do you know the value of the point? Probably the x value will always be 0. y should change. This works for me:

Code:
- (void)scrollViewDidScroll:(UIScrollView *)inscrollView
{
	CGPoint	p = inscrollView.contentOffset;
	
	NSLog(@"x = %f, y = %f", p.x, p.y);
}
I get results like:

Code:
2008-09-22 21:04:16.122 ScrollViewTest[29247:20b] x = 0.000000, y = 13.000000
2008-09-22 21:04:16.138 ScrollViewTest[29247:20b] x = 0.000000, y = 29.000000
2008-09-22 21:04:16.155 ScrollViewTest[29247:20b] x = 0.000000, y = 47.000000
2008-09-22 21:04:16.172 ScrollViewTest[29247:20b] x = 0.000000, y = 63.000000
PhoneyDeveloper is offline   0 Reply With Quote
Old Sep 22, 2008, 10:05 PM   #6
john903
Thread Starter
macrumors member
 
Join Date: Apr 2008
Ah, Thanks! I was printing the values out using "%d". Works now!
john903 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Do you show your scroll bars by default? PicnicTutorials OS X Mavericks (10.9) 3 Feb 4, 2014 08:50 AM
Scroll bars...how to darken? jordan2 OS X Mavericks (10.9) 4 Dec 1, 2013 07:59 AM
Resolved: UIScrollView does not scroll a UIImageView Tex-Twil iPhone/iPad Programming 4 Nov 20, 2013 06:57 AM
Scroll Bars are annoying How can i remove them. Prime85 OS X 10.8 Mountain Lion 6 Aug 9, 2012 09:40 PM
growing scroll bars Drew017 OS X 10.8 Mountain Lion 0 Jul 26, 2012 09:58 PM

Forum Jump

All times are GMT -5. The time now is 04:21 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC