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 05-06-2010, 08:47 PM   #1 (permalink)
Registered Member
 
krye's Avatar
 
Join Date: Jan 2009
Location: NY, USA
Posts: 359
krye is on a distinguished road
Default Paging in UIScrollView broken in iPad 3.2?

Finally got my hands on an iPad and just noticed now that my UIScrollvew is corrupted in one of my apps when you scroll left or right. It works fine on iPhone 3.1.3. But it broken on the iPad. Need to fix this fast since it's on the store.

It has something to do with Paging and Bounce Scroll being checked off in IB. I disabled them and it's OK now, but I'm left without paging.

Anyone found a way to fix it?

Last edited by krye; 05-06-2010 at 08:52 PM.
krye is offline   Reply With Quote
Old 05-19-2010, 05:42 PM   #2 (permalink)
Registered Member
 
krye's Avatar
 
Join Date: Jan 2009
Location: NY, USA
Posts: 359
krye is on a distinguished road
Default

Quote:
Originally Posted by krye View Post
Finally got my hands on an iPad and just noticed now that my UIScrollvew is corrupted in one of my apps when you scroll left or right. It works fine on iPhone 3.1.3. But it broken on the iPad. Need to fix this fast since it's on the store.

It has something to do with Paging and Bounce Scroll being checked off in IB. I disabled them and it's OK now, but I'm left without paging.

Anyone found a way to fix it?
Wow, haven't been able to find an answer to this. I wonder if it is a bug?
krye is offline   Reply With Quote
Old 05-19-2010, 11:14 PM   #3 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 9
Ray9s is on a distinguished road
Default

Yeah, I've been having issues with scrollview in 3.2 as well. Just figured I was doing something wrong. Hopefully someone has some insight.
Ray9s is offline   Reply With Quote
Old 05-20-2010, 03:25 PM   #4 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: Poznan, Poland
Posts: 32
wojtkow is on a distinguished road
Default

I have this same problem, in typical:

Code:
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
	CGFloat pageWidth = scrollView.frame.size.width;
    int page = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
}
I have crazy results, because scrollView.contentOffset.x always returns 0.
__________________
My apps:
Paths
Project Planner
Project Planner HD
wojtkow is offline   Reply With Quote
Old 05-20-2010, 03:38 PM   #5 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 247
linkmx is on a distinguished road
Default

Weird, I'm using a scrollview with paging on the iPad and I haven't had any problems.
linkmx is offline   Reply With Quote
Old 05-20-2010, 04:58 PM   #6 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: Poznan, Poland
Posts: 32
wojtkow is on a distinguished road
Default

Can you post how you create UIScrollView?
There is my code:

Code:
- (void)layoutScrollImages {
	
	int imageWidth = (PMI_MINIATURE_WIDTH + PMI_MARGIN_LEFT +PMI_MARGIN_RIGHT);
	int popr = ([scrollView bounds].size.width -imageWidth) /2;
	
	UIImageView *view = nil;
	NSArray *subviews = [scrollView subviews];

	// reposition all image subviews in a horizontal serial fashion
	CGFloat curXLoc = popr;
	for (view in subviews)
	{
		if ([view isKindOfClass:[ProjectImageView class]] && view.tag > 0)
		{
			CGRect frame = view.frame;
			frame.origin = CGPointMake(curXLoc, 0);
			view.frame = frame;
			
			curXLoc += (imageWidth +popr*2);
		}
	}
	
	// set the content size so it can be scrollable
	int size = dataArray.count * (imageWidth +2*popr);
	[scrollView setContentSize:CGSizeMake(size, scrollView.bounds.size.height)];



}

- (void)createView {
	if (self.dataArray != nil) {
		for (int i=0; i<self.dataArray.count; i++) {
			Project *project = (Project *)[self.dataArray objectAtIndex:i];
			UIImage *image = [UIImage imageWithData:project.miniature];
			ProjectImageView *imageView = [[ProjectImageView alloc] initWithImage:image];
			[imageView setDelegate:self];
			[imageView setImageName:project.projectName];

			imageView.tag = i+1;	// tag our images for later use when we place them in serial fashion
			imageView.userInteractionEnabled = YES;
			[scrollView addSubview:imageView];
			[imageView release];
		}
		
	}	
}

- (void)viewDidLoad {
    scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(20, 67, 728, 680)];
    scrollView.pagingEnabled = YES;
    scrollView.backgroundColor = [UIColor clearColor];
    scrollView.showsHorizontalScrollIndicator = NO;
    scrollView.showsVerticalScrollIndicator = NO;
    scrollView.scrollsToTop = NO;
    scrollView.delegate = self;
    scrollView.userInteractionEnabled = YES;
	
    [self.view addSubview:scrollView];

    [self createView];
    [self layoutScrollImages];
}
__________________
My apps:
Paths
Project Planner
Project Planner HD
wojtkow is offline   Reply With Quote
Old 06-16-2010, 10:17 AM   #7 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 6
hveveris is on a distinguished road
Default UIScrollView bug

I think the same or a similar bug is described here: Bynomial Code UIScrollView bug . Ran into the same problem when tried to custom animate UIScrollView after didEndDragging event.
SDK 3.1.3 was fine - this appeared starting from sdk 3.2
hveveris is offline   Reply With Quote
Old 08-04-2010, 09:53 PM   #8 (permalink)
Registered Member
 
Join Date: Apr 2008
Location: Houston, Texas
Posts: 10
bshirley is an unknown quantity at this point
Default Same problem, possible fix

I was having a problem with my scroll view in iPad as well.
Often the pages were being set half-way through.
I am also customizing some of the movement inside the scroll view.

I was setting the contentOffset at launch.
This caused scrollViewDidScroll: to be called.

though the frame said it was 960 wide, the standardOffset value below was being set to 480, i removed my superstitious casting of these values and the value went back to 960,

the processing that was being performed depending upon offset i think was all of my issues,

CGUInteger offset = [scrolledView contentOffset].x;
CGUInteger standardOffset = (CGUInteger)[scrolledView frame].size.width;

CGFloat offset = [scrolledView contentOffset].x;
CGFloat standardOffset = [scrolledView frame].size.width;


my suggestion, break in scrollViewDidScroll: and look for problems
bshirley 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: 322
15 members and 307 guests
Abidullah, baja_yu, cgokey, Duncan C, Fstuff, gbenna, guusleijsten, jbro, mdpauley, n00b, newDev, Sami Gh, seokwon lee, stanny, Steven.C
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,113
Posts: 402,877
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

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