Bug 5702 - UIScrollview with paging enabled shows "Stop offset can not be modified for paging scroll views" when registering events
Summary: UIScrollview with paging enabled shows "Stop offset can not be modified for p...
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 5.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-06-18 07:35 UTC by Henning
Modified: 2016-02-17 17:17 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Henning 2012-06-18 07:35:45 UTC
Hi if I register for the scrolled and/or the DecelerationEnded event than I get the "Stop offset can not be modified for paging scroll views" message in the Output window. Maybe there is a bug in the background handling?

Maybe this causes followup errors because sometimes I get weired behavior of the scrollview. Then the added views do no longer "magnet" the pages to the screen while scrolling.

Here ist the code that reproduces the "Stop offset can not be modified for paging scroll views" alert.

public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			UIScrollView scrollView = new UIScrollView(new RectangleF(0, 0, this.View.Bounds.Width, this.View.Bounds.Height));
			
			float pageWidth = scrollView.Frame.Size.Width;
		    float pageHeight = 0;
		   	
			scrollView.BackgroundColor = UIColor.White;
			scrollView.Frame = new RectangleF(0,0, pageWidth, pageHeight);
			scrollView.ClipsToBounds = false;
			scrollView.Scrolled += HandleScrolled;
			scrollView.DecelerationEnded += HandleDecelerationEnded;
			
			int count = 3;
			RectangleF scrollFrame = scrollView.Frame;
			scrollFrame.Width = scrollFrame.Width * count;
			scrollView.ContentSize = scrollFrame.Size;
			scrollView.PagingEnabled = true;
			scrollView.ShowsHorizontalScrollIndicator = false;
		
			List<UIViewController> controllers = new List<UIViewController>();
			
			controllers.Add(new UIViewController());
			controllers.Add(new UIViewController());
			controllers.Add(new UIViewController());
				
			UIPageControl pageControl = new UIPageControl();
			
			pageControl.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
			pageControl.Pages = count;
			pageControl.UserInteractionEnabled = false;
			pageControl.BackgroundColor = UIColor.Clear;
			
			pageControl.CurrentPage = 0;
			
			this.View = scrollView;
		}

		void HandleDecelerationEnded (object sender, EventArgs e)
		{
			
		}

		void HandleScrolled (object sender, EventArgs e)
		{
			
		}
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-06-20 07:15:04 UTC
I'm not sure what's going on, but using a UIPageControl like this works (from here: http://stackoverflow.com/a/1805226/183422):

private UIPageControl _pageCont;
private UIScrollView _scView;

public override void ViewDidLoad ()
{
	base.ViewDidLoad ();

	UIPageControl pageControll = new UIPageControl (new RectangleF (0, this.View.Bounds.Height - 25, this.View.Bounds.Width, 25));
	pageControll.BackgroundColor = UIColor.Red;
	pageControll.Alpha = 0.7f;
	pageControll.Pages = 3;
	this._pageCont = pageControll;

	this._scView = new UIScrollView ();
	this._scView.Scrolled += (sender, e) => { Console.WriteLine ("Scrolled"); };
	this._scView.PagingEnabled = true;
	//this._scView.Frame = new RectangleF (0, 0, View.Bounds.Width, View.Bounds.Height);
	this._scView.ContentSize = new SizeF (_scView.Frame.Width * 3, _scView.Frame.Height);
	this._scView.ShowsHorizontalScrollIndicator = true;
	this._scView.BackgroundColor = UIColor.Blue;
	this._scView.AddSubview (_pageCont);
	this.View = this._scView;     
	
	pageControll.Frame = new RectangleF (0, pageControll.Frame.Location.Y, this._scView.Frame.Size.Width, pageControll.Frame.Height); 
}
Comment 2 Henning 2012-07-04 04:25:16 UTC
Hi Rofl!
Thank you for your response!

Because I did not manage to fix this I edited the sample to be as tiny as possible to reproduce it. So here it is. Would you please change it to make it run so that I can easily see what causes the error?

At first can you even reproduce the "Stop offset can not be modified for paging scroll views" output message with the code below?

public override void ViewDidLoad ()
		{
			UIScrollView scrollView = new UIScrollView(new RectangleF(0, 0, this.View.Bounds.Width, this.View.Bounds.Height-58));
								    
			scrollView.BackgroundColor = UIColor.Black;
			scrollView.DecelerationEnded += HandleDecelerationEnded;

			scrollView.ContentSize = new SizeF (scrollView.Frame.Width *2, scrollView.Frame.Height);
			scrollView.PagingEnabled = true;
			
			this.View.AddSubview(scrollView);

		}
	
		void HandleDecelerationEnded (object sender, EventArgs e)
		{
			
		}
Comment 3 Rolf Bjarne Kvinge [MSFT] 2016-02-17 17:17:28 UTC
I can't reproduce this anymore (test project: https://github.com/rolfbjarne/TestApp/tree/bug5702), so it was probably an iOS bug that Apple fixed at some point.