FSCalendar icon indicating copy to clipboard operation
FSCalendar copied to clipboard

(Q) How do I insert text or string label into cell?

Open synabreu opened this issue 6 years ago • 3 comments

Hello, WenchaoD

I have a question for you about how to insert text or string label into cell on FSCalendar. As a swift beginner, I've already executed your demo codes and then found fake title when using interface builder. But I have no idea that how to do. So my plan is to populate text with cell from Firebase database like the attached file. Please let me know any tips, APIs and examples. Thanks in advance!

  • Jinho

My Development Environment

  • Device modal and iOS version - iPhoneX and iOS 11.4.
  • Xcode version - xCode 9.4, Swift 4.1
  • FSCalendar version - FSCalenda 2.7.9

img_5416

synabreu avatar Jun 08 '18 04:06 synabreu

func calendar(_ calendar: FSCalendar, willDisplay cell: FSCalendarCell, for date: Date, at monthPosition: FSCalendarMonthPosition) {

    let labelMy2 = UILabel(frame: CGRect(x: 10, y: 20, width: cell.bounds.width, height: 20))
    labelMy2.font = UIFont(name: "Henderson BCG Sans", size: 10)
    labelMy2.text = "abc"
    labelMy2.layer.cornerRadius = cell.bounds.width/2
    labelMy2.textColor = UIColor.init(hex: "#32C77F")
    cell.addSubview(labelMy2)

}

chaitanya-neosoft avatar May 27 '20 15:05 chaitanya-neosoft

Check link : https://stackoverflow.com/questions/62016056/show-event-label-string-on-calendar-view-ios/62047338#62047338

chaitanya-neosoft avatar May 27 '20 15:05 chaitanya-neosoft

@synabreu Do you have above demo?

anis-mansuri avatar Apr 22 '22 11:04 anis-mansuri