예제 #1
0
        public override void LoadView()
        {
            base.LoadView();
            View = new UIView(UIScreen.MainScreen.Bounds)
            {
                BackgroundColor = UIColor.White
            };
            Calendar = new FSCalendar()
            {
                Frame = new CGRect(0,
                                   NavigationController.NavigationBar.Frame.GetMaxY(),
                                   View.Frame.Width,
                                   View.Frame.Height - NavigationController.NavigationBar.Frame.GetMaxY()
                                   ),
                PagingEnabled           = false,
                AllowsMultipleSelection = true,
                RowHeight       = 60,
                PlaceholderType = FSCalendarPlaceholderType.None
            };
            Calendar.DataSource   = this;
            Calendar.WeakDelegate = this;

            View.AddSubview(Calendar);

            Calendar.FSAppearance.TitleDefaultColor = UIColor.Black;
            Calendar.FSAppearance.HeaderTitleColor  = UIColor.Black;
            Calendar.FSAppearance.TitleFont         = UIFont.SystemFontOfSize(16);
            Calendar.WeekdayHeight = 0;

            Calendar.SwipeToChooseGesture.Enabled = true;

            Calendar.Today = null; // Hide the today circle
            Calendar.RegisterClass(new ObjCRuntime.Class(typeof(RangePickerCell)), "cell");
        }
예제 #2
0
        public override void LoadView()
        {
            View = new UIView(UIScreen.MainScreen.Bounds)
            {
                BackgroundColor = UIColor.GroupTableViewBackgroundColor
            };

            var height = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? 450 : 300;

            Calendar = new FSCalendar()
            {
                Frame                   = new CGRect(0, NavigationController.NavigationBar.Frame.GetMaxY(), View.Frame.Width, height),
                DataSource              = this,
                WeakDelegate            = this,
                AllowsMultipleSelection = true
            };
            Calendar.SwipeToChooseGesture.Enabled = true;
            View.AddSubview(Calendar);

            Calendar.CalendarHeaderView.BackgroundColor  = UIColor.LightGray.ColorWithAlpha(0.1f);
            Calendar.CalendarWeekdayView.BackgroundColor = UIColor.LightGray.ColorWithAlpha(0.1f);
            Calendar.FSAppearance.EventSelectionColor    = UIColor.White;
            Calendar.FSAppearance.EventOffset            = new CGPoint(0, -7);
            Calendar.Today = null; // Hide the today circle
            Calendar.RegisterClass(new ObjCRuntime.Class(typeof(DIYCalendarCell)), "cell");
            var scopeGesture = new UIPanGestureRecognizer((UIPanGestureRecognizer obj) => {
                Calendar.HandleScopeGesture(obj);
            });

            Calendar.AddGestureRecognizer(scopeGesture);

            EventLabel = new UILabel(new CGRect(0, Calendar.Frame.GetMaxY() + 10, View.Frame.Width, 50))
            {
                TextAlignment = UITextAlignment.Center,
                Font          = UIFont.GetPreferredFontForTextStyle(UIFontTextStyle.Subheadline)
            };
            View.AddSubview(EventLabel);

            var attributedText = new NSMutableAttributedString("");
            var attatchment    = new NSTextAttachment()
            {
                Image = UIImage.FromBundle("icon_cat")
            };

            attatchment.Bounds = new CGRect(0, -3, attatchment.Image.Size.Width, attatchment.Image.Size.Height);
            attributedText.Append(NSAttributedString.FromAttachment(attatchment));
            attributedText.Append(new NSAttributedString(" This is a daily event "));
            attributedText.Append(NSAttributedString.FromAttachment(attatchment));
            EventLabel.AttributedText = attributedText;
        }