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 68020
 
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 68020
 
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
scrolling a UIScrollView on the click of a button ashwinr87 iPhone/iPad Programming 2 Jun 17, 2011 01:00 PM
UIScrollView - Showing user more content is available on scroll ashwinr87 iPhone/iPad Programming 4 May 23, 2011 12:03 PM
UIScrollView untouchable as subclass, fine normally carlosbutler iPhone/iPad Programming 1 Apr 28, 2011 09:49 PM
drag images in & out of UIScrollview BarryK88 iPhone/iPad Programming 3 Mar 23, 2011 05:49 AM
scroll a uitextfield and a uitextview in a uiscrollview franium iPhone/iPad Programming 14 Dec 4, 2010 02:51 AM


All times are GMT -5. The time now is 11:59 AM.

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

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC