public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.presenterDelegate = new CalendarPresenterDelegate(this);

            UIToolbar toolbar = new UIToolbar(new CGRect(0, this.View.Frame.Size.Height - 44, this.View.Bounds.Size.Width, 44));

            toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.View.AddSubview(toolbar);

            UIBarButtonItem buttonPrev = new UIBarButtonItem("Prev month", UIBarButtonItemStyle.Plain, this, new Selector("PrevTouched"));
            UIBarButtonItem buttonNext = new UIBarButtonItem("Next month", UIBarButtonItemStyle.Plain, this, new Selector("NextTouched"));
            UIBarButtonItem space      = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, this, null);

            toolbar.Items = new UIBarButtonItem[] { buttonPrev, space, buttonNext };

            CGRect rect = new CGRect(0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - toolbar.Frame.Size.Height);

            this.CalendarView = new TKCalendar(rect);
            this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            this.CalendarView.Delegate         = new CalendarDelegate(this);
            this.CalendarView.AllowPinchZoom   = false;
            this.View.AddSubview(CalendarView);

            TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter;

            presenter.TransitionMode = TKCalendarTransitionMode.Flip;
            presenter.Delegate       = new CalendarPresenterDelegate(this);
            presenter.ContentView.BackgroundColor = this.Colors [ColorIndex];
            this.TransitionMode = TKCalendarTransitionMode.Flip;
        }
Beispiel #2
0
        public override void ViewDidLoad()
        {
            this.AddOption("Flip Effect", SelectFlipEffect);
            this.AddOption("Float Effect", SelectedFloatEffect);
            this.AddOption("Fold Effect", SelectedFoldEffect);
            this.AddOption("Rotate Effect", SelectedRotateEffect);
            this.AddOption("Card Effect", SelectedCardEffect);
            this.AddOption("Scroll Effect", SelectedScrollEffect);

            base.ViewDidLoad();

            this.calendarDelegate  = new CalendarDelegate(this);
            this.presenterDelegate = new CalendarPresenterDelegate(this);

            UIToolbar toolbar = new UIToolbar(new CGRect(0, this.View.Frame.Size.Height - 44, this.View.Bounds.Size.Width, 44));

            toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.View.AddSubview(toolbar);

            UIBarButtonItem buttonPrev = new UIBarButtonItem("Prev month", UIBarButtonItemStyle.Plain, this, new Selector("PrevTouched"));
            UIBarButtonItem buttonNext = new UIBarButtonItem("Next month", UIBarButtonItemStyle.Plain, this, new Selector("NextTouched"));
            UIBarButtonItem space      = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, this, null);

            toolbar.Items = new UIBarButtonItem[] { buttonPrev, space, buttonNext };

            CGRect rect = new CGRect(0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - toolbar.Frame.Size.Height);

            this.CalendarView = new TKCalendar(rect);
            this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            this.CalendarView.Delegate         = calendarDelegate;
            this.CalendarView.AllowPinchZoom   = false;
            this.View.AddSubview(CalendarView);

            NSDate           date       = NSDate.Now;
            NSDateComponents components = new NSDateComponents();

            components.Year           = -1;
            this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, NSCalendarOptions.None);
            components.Year           = 1;
            this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, NSCalendarOptions.None);

            // >> transitions-monthpresenter-cs
            TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter;

            presenter.TransitionMode = TKCalendarTransitionMode.Flip;
            // << transitions-monthpresenter-cs
            presenter.Delegate = new CalendarPresenterDelegate(this);
            // >> transitions-transitionvertical-cs
            presenter.TransitionIsVertical = true;
            // << transitions-transitionvertical-cs
            presenter.ContentView.BackgroundColor = this.Colors [ColorIndex];
            // >> transitions-transitionduration-cs
            presenter.TransitionDuration = 2;
            // << transitions-transitionduration-cs
            this.TransitionMode = TKCalendarTransitionMode.Flip;
        }
        public void SetTransition(TKCalendarTransitionMode transitionMode, bool isVertical)
        {
            this.CalendarView.ViewMode = TKCalendarViewMode.Month;
            TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter;

            presenter.Delegate             = presenterDelegate;
            presenter.HeaderIsSticky       = true;
            presenter.TransitionIsVertical = isVertical;
            presenter.TransitionMode       = transitionMode;
            this.TransitionMode            = transitionMode;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            this.calendarDelegate  = new CalendarDelegate (this);
            this.presenterDelegate = new CalendarPresenterDelegate (this);

            UIToolbar toolbar = new UIToolbar (new CGRect (0, this.View.Frame.Size.Height - 44, this.View.Bounds.Size.Width, 44));
            toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.View.AddSubview (toolbar);

            UIBarButtonItem buttonPrev = new UIBarButtonItem("Prev month", UIBarButtonItemStyle.Plain, this, new Selector("PrevTouched"));
            UIBarButtonItem buttonNext = new UIBarButtonItem("Next month", UIBarButtonItemStyle.Plain, this, new Selector("NextTouched"));
            UIBarButtonItem space = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, this, null);
            toolbar.Items = new UIBarButtonItem[] { buttonPrev, space, buttonNext };

            CGRect rect = new CGRect (0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - toolbar.Frame.Size.Height);
            this.CalendarView = new TKCalendar (rect);
            this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            this.CalendarView.Delegate = calendarDelegate;
            this.CalendarView.AllowPinchZoom = false;
            this.View.AddSubview (CalendarView);

            NSDate date = NSDate.Now;
            NSDateComponents components = new NSDateComponents ();
            components.Year = -1;
            this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, NSCalendarOptions.None);
            components.Year = 1;
            this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, NSCalendarOptions.None);

            TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter;
            presenter.TransitionMode = TKCalendarTransitionMode.Flip;
            presenter.Delegate = new CalendarPresenterDelegate (this);
            presenter.ContentView.BackgroundColor = this.Colors [ColorIndex];
            this.TransitionMode = TKCalendarTransitionMode.Flip;
        }
 public void SetTransition(TKCalendarTransitionMode transitionMode, bool isVertical)
 {
     this.CalendarView.ViewMode = TKCalendarViewMode.Month;
     TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter;
     presenter.Delegate = presenterDelegate;
     presenter.HeaderIsSticky = true;
     presenter.TransitionIsVertical = isVertical;
     presenter.TransitionMode = transitionMode;
     this.TransitionMode = transitionMode;
 }