@@ -11,7 +11,7 @@ _calendar.scrollDirection = FSCalendarScrollDirectionVertical;
11
11
* Swift
12
12
13
13
``` swift
14
- calendar.scrollDirection = .Vertical
14
+ calendar.scrollDirection = .vertical
15
15
```
16
16
17
17
![ fscalendar-vertical] ( https://cloud.githubusercontent.com/assets/5186464/8448624/384e344c-1ffc-11e5-8b0b-1c3951dab2e1.gif )
@@ -56,7 +56,7 @@ calendar.scrollDirection = .Horizontal
56
56
57
57
### For week mode
58
58
59
- * Objective - c
59
+ * Objective-C
60
60
61
61
``` objective-c
62
62
_calendar.scope = FSCalendarScopeWeek;
@@ -65,7 +65,7 @@ _calendar.scope = FSCalendarScopeWeek;
65
65
* Swift
66
66
67
67
``` swift
68
- calendar.scope = .Week
68
+ calendar.scope = .week
69
69
```
70
70
71
71
### For month mode
@@ -79,38 +79,65 @@ _calendar.scope = FSCalendarScopeMonth; // By default
79
79
* Swift
80
80
81
81
``` swift
82
- calendar.scope = .Month
82
+ calendar.scope = .month
83
83
```
84
84
85
85
![ fscalendar-scope] ( https://cloud.githubusercontent.com/assets/5186464/12474251/aec94a32-c054-11e5-8b30-9e3d03d9a846.gif )
86
86
87
87
### To select more than one date
88
88
89
+ * Objective-C
90
+
89
91
``` objective-c
90
- _calendar .allowsMultipleSelection = YES ;
92
+ calendar .allowsMultipleSelection = YES ;
91
93
```
92
94
95
+ * Swift
96
+
97
+ ``` swift
98
+ calendar.allowsMultipleSelection = true ;
99
+ ```
100
+
101
+
93
102
![ fscalendar-mulipleselection] ( https://cloud.githubusercontent.com/assets/5186464/9751497/368f55f6-56d8-11e5-9af5-0d09ba13f0eb.png )
94
103
95
104
### If you want ` FSCalendar ` to use ` Monday ` as the first column (or any other weekday)
96
105
106
+ * Objective-C
107
+
97
108
``` objective-c
98
109
_calendar.firstWeekday = 2 ;
99
110
```
100
111
112
+ * Swift
113
+
114
+ ``` swift
115
+ calendar.firstWeekday = 2
116
+ ```
117
+
101
118
![ fscalendar---monday] ( https://cloud.githubusercontent.com/assets/5186464/8448782/c92505e4-1ffd-11e5-95c0-9bf3c8bec669.png )
102
119
103
120
104
121
### The date format of header can be customized
105
122
123
+ * Objective-C
124
+
106
125
``` objective-c
107
- _calendar.appearance.headerDateFormat = @" MMM yy" ;
126
+ calendar.appearance.headerDateFormat = @" MMM yy" ;
127
+ ```
128
+
129
+ * Swift
130
+
131
+ ``` swift
132
+ calendar.appearance .headerDateFormat = " MMM yy"
108
133
```
109
134
110
135
![ fscalendar---headerformat] ( https://cloud.githubusercontent.com/assets/5186464/8449322/15d79168-2003-11e5-997a-06c6721dd807.png )
111
136
112
137
### You can define the appearance
113
138
139
+ * Objective-c
140
+
114
141
``` objective-c
115
142
_calendar.appearance.weekdayTextColor = [UIColor redColor ];
116
143
_calendar.appearance.headerTitleColor = [UIColor redColor ];
@@ -120,25 +147,39 @@ _calendar.appearance.todayColor = [UIColor orangeColor];
120
147
_calendar.appearance.todaySelectionColor = [UIColor blackColor ];
121
148
```
122
149
150
+ * Swift
151
+
152
+ ``` objective-c
153
+ calendar.appearance.weekdayTextColor = UIColor.redColor
154
+ calendar.appearance.headerTitleColor = UIColor.redColor
155
+ calendar.appearance.eventColor = UIColor.greenColor
156
+ calendar.appearance.selectionColor = UIColor.blueColor
157
+ calendar.appearance.todayColor = UIColor.orangeColor
158
+ calendar.appearance.todaySelectionColor = UIColor.blackColor
159
+ ```
160
+
161
+
123
162
![ fscalendar---colors] ( https://cloud.githubusercontent.com/assets/5186464/8449300/d55d1c7a-2002-11e5-8de6-be04f3783456.png )
124
163
125
164
### The day shape doesn't have to be a circle
126
165
127
- * Objective - c
166
+ * Objective-C
167
+
128
168
``` objective-c
129
- _calendar .appearance.cellStyle = FSCalendarCellStyleRectangle;
169
+ calendar .appearance.borderRadius = 0
130
170
```
131
171
132
172
* Swift
173
+
133
174
``` swift
134
- calendar.appearance .cellStyle = . Rectangle
175
+ calendar.appearance .borderRadius = 0
135
176
```
136
177
137
178
![ fscalendar---rectangle] ( https://cloud.githubusercontent.com/assets/5186464/8449186/d38ea39c-2001-11e5-99f4-32fcd6120a01.png )
138
179
139
180
### ` FSCalendar ` can show subtitle for each day
140
181
141
- * Objective - c
182
+ * Objective-C
142
183
143
184
``` objective-c
144
185
// FSCalendarDataSource
@@ -152,7 +193,7 @@ calendar.appearance.cellStyle = .Rectangle
152
193
153
194
``` swift
154
195
// FSCalendarDataSource
155
- func calendar (calendar : FSCalendar! , subtitleForDate date : NSDate! ) -> String ! {
196
+ func calendar (_ calendar : FSCalendar! , subtitleFor date : NSDate! ) -> String ! {
156
197
return yourSubtitle
157
198
}
158
199
```
@@ -163,7 +204,7 @@ func calendar(calendar: FSCalendar!, subtitleForDate date: NSDate!) -> String! {
163
204
164
205
### And event dot for some days
165
206
166
- * Objective - c
207
+ * Objective-C
167
208
168
209
``` objective-c
169
210
// FSCalendarDataSource
@@ -198,7 +239,7 @@ func calendar(calendar: FSCalendar!, hasEventForDate date: NSDate!) -> Bool {
198
239
199
240
``` swift
200
241
// FSCalendarDataSource
201
- func calendar (calendar : FSCalendar! , imageForDate date : NSDate! ) -> UIImage! {
242
+ func calendar (_ calendar : FSCalendar! , imageFor date : NSDate! ) -> UIImage! {
202
243
return anyImage
203
244
}
204
245
```
@@ -207,7 +248,7 @@ func calendar(calendar: FSCalendar!, imageForDate date: NSDate!) -> UIImage! {
207
248
208
249
#### You can hide top and bottom borders
209
250
210
- * Objective - c
251
+ * Objective-C
211
252
212
253
``` objective-c
213
254
calendar.clipsToBounds = YES
@@ -285,9 +326,9 @@ func calendar(calendar: FSCalendar!, shouldSelectDate date: NSDate!) -> Bool {
285
326
```
286
327
287
328
288
- ### You will get notified when ` FSCalendar ` changes the month
329
+ ### You will get notified when ` FSCalendar ` changes the month or week
289
330
290
- * Objective - c
331
+ * Objective-C
291
332
292
333
``` objective-c
293
334
- (void )calendarCurrentMonthDidChange:(FSCalendar *)calendar
@@ -299,7 +340,7 @@ func calendar(calendar: FSCalendar!, shouldSelectDate date: NSDate!) -> Bool {
299
340
* Swift
300
341
301
342
``` swift
302
- func calendarCurrentMonthDidChange (calendar : FSCalendar! ) {
343
+ func calendarCurrentMonthDidChange (_ calendar : FSCalendar! ) {
303
344
// Do something
304
345
}
305
346
```
0 commit comments