Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-24-2010, 11:36 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 169
dbarrett is on a distinguished road
Default scrollview bug?

I'm seeing an issue with UIScrollView and I can't figure out what's causing it.

Basically, I have a UIView w/ a UIScrollView. When the UIView is pushed onto the stack, an image & some text is displayed within the scrollview. From there the user can popViewController back to the original view. Simple enough...

The issue I'm seeing is that with the scrollView appears, the scroll is scrolled halfway down. Seems to be at random. Sometimes the scroll is @ the top.

Keep in mind both the heights of the image and the textView are dynamic.

in the ViewWillAppear method, I have this:

Code:
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

	CGSize textViewSize = self.myText.contentSize;
        CGRect textViewFrame = self.myText.frame;
	textViewFrame.size.height = textViewSize.height;
        self.myText.frame = textViewFrame;
	
	float imageHeight = myImage.image.size.height;
	float textViewHeight = textViewSize.height;
	
	[scrollView setScrollsToTop:YES];
	[scrollView setScrollEnabled:YES];
	[scrollView setContentOffset:CGPointMake(0.0, 0.0) animated:NO];	
	[scrollView setContentSize:CGSizeMake(320, imageHeight + textViewHeight)];

}
Any ideas as to what I'm doing wrong?

Thanks.

Last edited by dbarrett; 08-24-2010 at 11:40 AM.
dbarrett is offline   Reply With Quote
Old 08-24-2010, 03:09 PM   #2 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: London/Peterborough
Posts: 562
QuantumDoja is on a distinguished road
Default

Quote:
Originally Posted by dbarrett View Post
Keep in mind both the heights of the image and the textView are dynamic.
- Is the data dynamic too?
QuantumDoja is offline   Reply With Quote
Old 08-24-2010, 03:39 PM   #3 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 169
dbarrett is on a distinguished road
Default

Quote:
Originally Posted by QuantumDoja View Post
- Is the data dynamic too?
Yes.
dbarrett is offline   Reply With Quote
Old 08-25-2010, 09:07 AM   #4 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 169
dbarrett is on a distinguished road
Default

Anyone?
dbarrett is offline   Reply With Quote
Old 08-25-2010, 03:14 PM   #5 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: London/Peterborough
Posts: 562
QuantumDoja is on a distinguished road
Default

I have to work 12 hour days dude, have a little patience.

First thing to try then is with some fixed data, if the scroll view scrolls back to where you were, then I would say the scrollview has some way of "remembering" where to scroll back to. Let me know.
QuantumDoja is offline   Reply With Quote
Old 08-25-2010, 08:53 PM   #6 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 169
dbarrett is on a distinguished road
Default

Quote:
Originally Posted by QuantumDoja View Post
I have to work 12 hour days dude, have a little patience.

First thing to try then is with some fixed data, if the scroll view scrolls back to where you were, then I would say the scrollview has some way of "remembering" where to scroll back to. Let me know.
Sorry man, I wasn't directing that toward you.

I'll give your suggestion a try.

Thanks.
dbarrett is offline   Reply With Quote
Old 08-31-2010, 07:21 AM   #7 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 169
dbarrett is on a distinguished road
Default

Quote:
Originally Posted by QuantumDoja View Post
I have to work 12 hour days dude, have a little patience.

First thing to try then is with some fixed data, if the scroll view scrolls back to where you were, then I would say the scrollview has some way of "remembering" where to scroll back to. Let me know.
Turns out it IS a bug in iOS4.

UIScrollView & setContentOffset random scrolling on iOS 4 | mFabrik - web and mobile development

Thanks!
dbarrett is offline   Reply With Quote
Old 09-14-2010, 01:53 AM   #8 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 2
Issy is on a distinguished road
Default

Quote:
Originally Posted by dbarrett View Post
Thanks for the link. I had the same problem.
Issy is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 347
7 members and 340 guests
dre, freewind, hain, HemiMG, lendo, Newbie123, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:58 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0