WenchaoD / FSCalendar

A fully customizable iOS calendar library, compatible with Objective-C and Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

in swift example i created two buttons: week, month with corresponding actions.

iOSayedAhmed opened this issue · comments

@IBAction func monthView(sender: UIButton) {
    self.calendar.setScope(.Month, animated: true)
}

@IBAction func weekView(sender: UIButton) {
    self.calendar.setScope(.Week, animated: true)
}
commented

I know you asked this quite a while ago, but I just did this and it appears to work just fine.

Remember to add
func calendar(_ calendar: FSCalendar, boundingRectWillChange bounds: CGRect, animated: Bool) {
self.calendarHeightConstraint.constant = bounds.height
self.view.layoutIfNeeded()
}
and that your ViewController conforms to :

class ViewController: UIViewController,FSCalendarDataSource, FSCalendarDelegate

and that you have a

@IBOutlet weak var calendarHeightConstraint: NSLayoutConstraint!

set to the height constraint from the storyboard.