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"); }
public override void Calendar(FSCalendar calendar, CGRect bounds, bool animated) { var calendarFrame = calendar.Frame; calendarFrame.Size = bounds.Size; calendar.Frame = calendarFrame; }
UIColor[] CalendarEventDefaultColorsForDate(FSCalendar calendar, FSCalendarAppearance appearance, NSDate date) { if (Gregorian.IsDateInToday(date)) { return(new UIColor[] { UIColor.Orange }); } return(new UIColor[] { appearance.EventDefaultColor }); }
string CalendarDateTitle(FSCalendar calendar, NSDate date) { if (Gregorian.IsDateInToday(date)) { return("Today"); } return(null); }
public override UIImage ImageForDate(FSCalendar calendar, NSDate date) { DateTime reference = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(2001, 1, 1, 0, 0, 0)); var d = reference.AddSeconds(date.SecondsSinceReferenceDate); if (d.Date == new DateTime(2016, 11, 17)) { return(UIImage.FromBundle("cake")); } return(new UIImage()); }
public override void ViewDidLoad() { base.ViewDidLoad(); var calendar = new FSCalendar(); calendar.DataSource = new CalendarDataSource(); calendar.Delegate = new CalendarDelegate(); calendar.Frame = new CGRect(0, 50, this.View.Bounds.Width, 300); this.View.AddSubview(calendar); calendar.ScopeGesture.Enabled = true; calendar.ReloadData(); }
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; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. // In loadView(Recommended) or viewDidLoad // FSCalendar* calendar = [[FSCalendar alloc] initWithFrame: CGRectMake(0, 0, 320, 300)]; // calendar.dataSource = self; // calendar.delegate = self; //[self.view addSubview:calendar]; //self.calendar = calendar; var calendar = new FSCalendar(); calendar.Frame = new CoreGraphics.CGRect(0, 0, 320, 300); View.Add(calendar); }
void CalendarDidSelectDate(FSCalendar calendar, NSDate date, FSCalendarMonthPosition monthPosition) { if (calendar.SwipeToChooseGesture.State == UIGestureRecognizerState.Changed) { // If the selection is caused by swipe gestures if (Date1 == null) { Date1 = date; } else { if (Date2 != null) { calendar.DeselectDate(Date2); } Date2 = date; } } else { if (Date2 != null) { calendar.DeselectDate(Date1); calendar.DeselectDate(Date2); Date1 = date; Date2 = null; } else if (Date1 == null) { Date1 = date; } else { Date2 = date; } } ConfigureVisibleCells(); }
void CalendarWillDisplayCell(FSCalendar calendar, FSCalendarCell cell, NSDate date, FSCalendarMonthPosition monthPosition) { ConfigCell(cell, date, monthPosition); }
NSDate MaximumDateForCalendar(FSCalendar calendar) { return(Gregorian.DateByAddingUnit(NSCalendarUnit.Month, 10, NSDate.Now, NSCalendarOptions.None)); }
NSDate MinimumDateForCalendar(FSCalendar calendar) { return(DateFormatter.Parse("2016-07-08")); }
public override void DidSelectDate(FSCalendar calendar, NSDate date) { Console.WriteLine(date); }
nint CalendarDateNumberOfEvents(FSCalendar calendar, NSDate date) { return(new Random().Next(0, 3)); }
void CalendarDidDeselectDate(FSCalendar calendar, NSDate date, FSCalendarMonthPosition monthPosition) { System.Diagnostics.Debug.WriteLine($"Did deselect date: {DateFormatter.ToString(date)}"); ConfigureVisibleCells(); }
bool CalendarShouldDeselectDate(FSCalendar calendar, NSDate date, FSCalendarMonthPosition monthPosition) { return(false); }
bool CalendarShouldSelectDate(FSCalendar calendar, NSDate date, FSCalendarMonthPosition monthPosition) { return(monthPosition == FSCalendarMonthPosition.Current); }
void CalendarBoundingRectWillChange(FSCalendar calendar, CGRect bounds, bool animated) { calendar.Frame = new CGRect(calendar.Frame.Location, bounds.Size); EventLabel.Frame = new CGRect(0, calendar.Frame.GetMaxY() + 10, View.Frame.Width, 50); }
FSCalendarCell CalendarCellForDate(FSCalendar calendar, NSDate date, FSCalendarMonthPosition position) { return(calendar.DequeueReusableCellWithIdentifier("cell", date, position)); }