ios - Showing Months and year as header through JTAppleCalendar -
i using jtapplecalendar in ios application finding difficult implement headers show month , year @ top of calendar conventional calendar would. have followed instructions in documentation still finding difficult despite managing add 'headers' show days of week albeit feel maybe not correctly. has implemented library before, can how this? or maybe calendar have used has easier way accomplish this?
documentation: https://patchthecode.github.io/headers/
i implement days of week so:
// sets height of header func calendar(_ calendar: jtapplecalendarview, sectionheadersizefor range: (start: date, end: date), belongingto month: int) -> cgsize { return cgsize(width: 200, height: 50) } // setups display of header func calendar(_ calendar: jtapplecalendarview, willdisplaysectionheader header: jtappleheaderview, range: (start: date, end: date), identifier: string) { let headercell = (header as? pinksectionheaderview) headercell?.title.text = "s m t w t f s" }
i think made whole lot more difficult should be.
what saw on tutorial site example of how can setup header simple uilabel on called title. not have follow if calendar design different. design wish.
it seems want not uilabel. want 7 labels; each representing day of week. easiest way create 7 uilabels inside of horizontal stackiew. stackview's spacing should set full , should set fill equally. have click on individual labels , set alignment center.
make constraints of stackview stretch ends of headerview. done. s|m|t|w|t|f|s view complete without hard coding spaces; bad thing do.
next seems want 2 labels. 1 month, , year. create labels in header view, , create outletlets them. can set them in following function.
func calendar(_ calendar: jtapplecalendarview, willdisplaysectionheader header: jtappleheaderview, range: (start: date, end: date), identifier: string) { } 


Comments
Post a Comment