/// <summary> /// Creates the new grid. /// </summary> /// <param name="date">The date.</param> /// <returns>MonthGridView.</returns> private EMonthGridView CreateNewGrid(DateTime date) { var grid = new EMonthGridView(this, date) { CurrentDate = CurrentDate }; grid.BuildGrid(); grid.Frame = new CGRect(0, 0, _width, Frame.Height - 16); return(grid); }
/// <summary> /// Rebuilds the grid. /// </summary> /// <param name="right">if set to <c>true</c> [right].</param> /// <param name="animated">if set to <c>true</c> [animated].</param> public void RebuildGrid(bool right, bool animated) { UserInteractionEnabled = false; var gridToMove = CreateNewGrid(CurrentMonthYear); var pointsToMove = (right ? Frame.Width : -Frame.Width); /*if (left && gridToMove.weekdayOfFirst==0) * pointsToMove += 44; * if (!left && _monthGridView.weekdayOfFirst==0) * pointsToMove -= 44;*/ gridToMove.Frame = new CGRect(new CGPoint(pointsToMove, 0), gridToMove.Frame.Size); _scrollView.AddSubview(gridToMove); if (animated) { BeginAnimations("changeMonth"); SetAnimationDuration(0.4); SetAnimationDelay(0.1); SetAnimationCurve(UIViewAnimationCurve.EaseInOut); } _monthGridView.Center = new CGPoint(_monthGridView.Center.X - pointsToMove, _monthGridView.Center.Y); gridToMove.Center = new CGPoint(gridToMove.Center.X - pointsToMove, gridToMove.Center.Y); _monthGridView.Alpha = 0; /*_scrollView.Frame = new RectangleF( * _scrollView.Frame.Location, * new SizeF(_scrollView.Frame.Width, this.Frame.Height-16)); * * _scrollView.ContentSize = _scrollView.Frame.Size;*/ SetNeedsDisplay(); if (animated) { CommitAnimations(); } _monthGridView = gridToMove; UserInteractionEnabled = true; if (MonthChanged != null) { MonthChanged(CurrentMonthYear); } }
/// <summary> /// Loads the initial grids. /// </summary> private void LoadInitialGrids() { _monthGridView = CreateNewGrid(CurrentMonthYear); /*var rect = _scrollView.Frame; * rect.Size = new SizeF { Height = (_monthGridView.Lines + 1) * 44, Width = rect.Size.Width }; * _scrollView.Frame = rect;*/ //Frame = new RectangleF(Frame.X, Frame.Y, _scrollView.Frame.Size.Width, _scrollView.Frame.Size.Height+16); /*var imgRect = _shadow.Frame; * imgRect.Y = rect.Size.Height - 132; * _shadow.Frame = imgRect;*/ }