From ea8ef3ed2b43163ba2353e96f78a6cf178d123b6 Mon Sep 17 00:00:00 2001 From: ycastonguay Date: Mon, 8 Jul 2013 16:07:42 -0400 Subject: [PATCH] iOS: Fixed scroll view bug after upgrading to iOS 7 Beta 3. Related to issue #405. --- .../Classes/Controllers/PlayerViewController.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/MPfm/MPfm.iOS/Classes/Controllers/PlayerViewController.cs b/MPfm/MPfm.iOS/Classes/Controllers/PlayerViewController.cs index d2dfe1d1..ef1b03c5 100644 --- a/MPfm/MPfm.iOS/Classes/Controllers/PlayerViewController.cs +++ b/MPfm/MPfm.iOS/Classes/Controllers/PlayerViewController.cs @@ -273,12 +273,17 @@ public void AddScrollView(UIViewController viewController) if (viewController is PlayerMetadataViewController) _playerMetadataViewController = (PlayerMetadataViewController)viewController; + // Hot fix for iOS 7 Beta 3 + int scrollSubviewsLength = 0; + if (scrollView.Subviews != null) + scrollSubviewsLength = scrollView.Subviews.Length; + if (UserInterfaceIdiomIsPhone) { - viewController.View.Frame = new RectangleF(scrollView.Subviews.Length * scrollView.Frame.Width, 0, scrollView.Frame.Width, scrollView.Frame.Height); + viewController.View.Frame = new RectangleF(scrollSubviewsLength * scrollView.Frame.Width, 0, scrollView.Frame.Width, scrollView.Frame.Height); scrollView.AddSubview(viewController.View); - pageControl.Pages = scrollView.Subviews.Length; - scrollView.ContentSize = new SizeF(scrollView.Subviews.Length * scrollView.Frame.Width, scrollView.Frame.Height); + pageControl.Pages = scrollSubviewsLength; + scrollView.ContentSize = new SizeF(scrollSubviewsLength * scrollView.Frame.Width, scrollView.Frame.Height); } else {