Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: A way to add more than one subtitleFor #517

Closed
matteopiccioni opened this issue Dec 20, 2016 · 2 comments
Closed

Request: A way to add more than one subtitleFor #517

matteopiccioni opened this issue Dec 20, 2016 · 2 comments

Comments

@matteopiccioni
Copy link

Hello,
if I have 2 or 3 event in day,
there is way to add all three subtitle under the right date in calendar view ?

@WenchaoD
Copy link
Owner

Hi @matteopiccioni The cell can be fully customized. The DIY example might help.

@matteopiccioni
Copy link
Author

Thanks.
In my opinion could be better if (for a day) I have:

  • One event: show detail_event_1
  • Two event: show detail_event_2
  • Three or more: show detail_event_1 and event dots

schermata 2016-12-22 alle 12 27 55
schermata 2016-12-22 alle 12 28 06

Anyway in my custom cell I make:

`

    override init(frame: CGRect) {
    super.init(frame: frame)
  
    let lbSecondaRiga = UILabel(frame: CGRect(x: 0, y: 15, width: 20, height: 10))
    lbSecondaRiga.textAlignment = .left
    lbSecondaRiga.lineBreakMode = .byWordWrapping
    lbSecondaRiga.textColor = self.subtitleLabel.textColor
    lbSecondaRiga.text = ""
    self.lbSecondaRiga = lbSecondaRiga
    
    
    let view = UIView(frame: self.bounds)
    view.backgroundColor = UIColor.lightGray.withAlphaComponent(0.12)
    view.insertSubview(self.lbSecondaRiga, belowSubview: self.subtitleLabel)
    self.backgroundView = view;
    
}

override func layoutSubviews() {
    super.layoutSubviews()
    
    
    self.lbSecondaRiga.frame = self.subtitleLabel.frame
    self.lbSecondaRiga.font = self.subtitleLabel.font
    self.lbSecondaRiga.textAlignment = self.subtitleLabel.textAlignment
    self.lbSecondaRiga.lineBreakMode = self.subtitleLabel.lineBreakMode
    self.lbSecondaRiga.textColor = self.subtitleLabel.textColor
    
    self.lbSecondaRiga.frame.origin.y += 10

}

`
in calendar delegate I have

private func configure(cell: FSCalendarCell, for date: Date, at position: FSCalendarMonthPosition) { ... let diyCell = (cell as! MyCalendarCell) diyCell.lbSecondaRiga.text = "second row event" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants