/// <summary> /// Create an SOViewController for each 'site' /// </summary> /// <remarks> /// Pager sample from /// http://simon.nureality.ca/?p=135 /// /// Attempts to load data from cache txt files, doesn't do WebClient requests. /// /// We store each SOViewController in the list so that we can /// call BecomeFirstResponder when we change views... this is because /// the 'shake gesture' goes to the FirstResponder /// </remarks> private void CreatePanels() { scrollView.Scrolled += ScrollViewScrolled; int count = siteCount; RectangleF scrollFrame = scrollView.Frame; scrollFrame.Width = scrollFrame.Width * count; scrollView.ContentSize = scrollFrame.Size; SOViewController defaultFirstResponderView = null; for (int i = 0; i < count; i++) { RectangleF frame = scrollView.Frame; PointF location = new PointF(); location.X = frame.Width * i; frame.Location = location; SOViewController cellController = new SOViewController(); NSBundle.MainBundle.LoadNib("SOViewController", cellController, null); cellController.View.Frame = frame; cellController.Site = list[i]; cellController.DocumentsDirectory = documentsDirectory; cellController.WireUp(); cellController.LoadFromCache(); list[i].ViewController = cellController; scrollView.AddSubview(cellController.View); if (i == 0) { defaultFirstResponderView = cellController; } // set the first one to FirstResponder } pageControl.Pages = count; defaultFirstResponderView.BecomeFirstResponder(); }
/// <summary> /// Create an SOViewController for each 'site' /// </summary> /// <remarks> /// Pager sample from /// http://simon.nureality.ca/?p=135 /// /// Attempts to load data from cache txt files, doesn't do WebClient requests. /// /// We store each SOViewController in the list so that we can /// call BecomeFirstResponder when we change views... this is because /// the 'shake gesture' goes to the FirstResponder /// </remarks> private void CreatePanels() { scrollView.Scrolled += ScrollViewScrolled; int count = siteCount; RectangleF scrollFrame = scrollView.Frame; scrollFrame.Width = scrollFrame.Width * count; scrollView.ContentSize = scrollFrame.Size; SOViewController defaultFirstResponderView = null; for (int i = 0; i < count; i++) { RectangleF frame = scrollView.Frame; PointF location = new PointF (); location.X = frame.Width * i; frame.Location = location; SOViewController cellController = new SOViewController (); NSBundle.MainBundle.LoadNib ("SOViewController", cellController, null); cellController.View.Frame = frame; cellController.Site = list[i]; cellController.DocumentsDirectory = documentsDirectory; cellController.WireUp (); cellController.LoadFromCache (); list[i].ViewController = cellController; scrollView.AddSubview (cellController.View); if (i == 0) defaultFirstResponderView = cellController; // set the first one to FirstResponder } pageControl.Pages = count; defaultFirstResponderView.BecomeFirstResponder (); }