iOS日歷視圖:GLCalendarView
GLCalendarView 是一款完全自定義的日歷視圖,可以作為日期范圍選擇器。
用法
- Init the view by placing it in the storyboard or programmatically init it and add it to your view controller.
- InviewDidLoad, set thefirstDateandlastDateof the calendarView.
- InviewWillAppear, set up the model data and call[self.calendarView reload];to refresh the calendarView.
To display some ranges in the calendar view, construct someGLCalendarDateRangeobjects, set them as the model of the calendar view
NSDate *today = [NSDate date]; NSDate *beginDate = [GLDateUtils dateByAddingDays:-23 toDate:today]; NSDate *endDate = [GLDateUtils dateByAddingDays:-18 toDate:today]; GLCalendarDateRange *range = [GLCalendarDateRange rangeWithBeginDate:beginDate endDate:endDate]; range.backgroundColor = COLOR_BLUE; range.editable = YES; range.binding = yourModelObject // you can bind your model to the range self.calendarView.ranges = [@[range1] mutableCopy]; [self.calendarView reload];
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!