-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCustomDateHeader.cs
More file actions
30 lines (25 loc) · 1.04 KB
/
CustomDateHeader.cs
File metadata and controls
30 lines (25 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using CoreGraphics;
using UIKit;
namespace CustomDayViewProviders.iOS {
public class CustomDateHeader : UIView {
CGSize weekDaySize;
CGSize dayNumberSize;
public CustomDateHeader() {
AddSubview(WeekDay = new UILabel());
AddSubview(DayNumber = new UILabel());
}
public UILabel WeekDay { get; }
public UILabel DayNumber { get; }
public override CGSize SizeThatFits(CGSize size) {
this.weekDaySize = WeekDay.SizeThatFits(size);
this.dayNumberSize = DayNumber.SizeThatFits(size);
return new CGSize(Math.Max(this.weekDaySize.Width, this.dayNumberSize.Width), this.weekDaySize.Height + this.dayNumberSize.Height);
}
public override void LayoutSubviews() {
WeekDay.Frame = new CGRect(0, 0, Bounds.Width, this.weekDaySize.Height);
DayNumber.Frame = new CGRect(0, this.weekDaySize.Height, Bounds.Width, Bounds.Height - this.weekDaySize.Height);
SetNeedsDisplay();
}
}
}