Skip to content

Commit dbca5ee

Browse files
author
Wenchao Ding
committed
Update MoreUsage.md
1 parent 6ee5595 commit dbca5ee

File tree

1 file changed

+58
-17
lines changed

1 file changed

+58
-17
lines changed

MOREUSAGE.md

+58-17
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ _calendar.scrollDirection = FSCalendarScrollDirectionVertical;
1111
* Swift
1212

1313
```swift
14-
calendar.scrollDirection = .Vertical
14+
calendar.scrollDirection = .vertical
1515
```
1616

1717
![fscalendar-vertical](https://cloud.githubusercontent.com/assets/5186464/8448624/384e344c-1ffc-11e5-8b0b-1c3951dab2e1.gif)
@@ -56,7 +56,7 @@ calendar.scrollDirection = .Horizontal
5656

5757
### For week mode
5858

59-
* Objective - c
59+
* Objective-C
6060

6161
```objective-c
6262
_calendar.scope = FSCalendarScopeWeek;
@@ -65,7 +65,7 @@ _calendar.scope = FSCalendarScopeWeek;
6565
* Swift
6666

6767
```swift
68-
calendar.scope = .Week
68+
calendar.scope = .week
6969
```
7070

7171
### For month mode
@@ -79,38 +79,65 @@ _calendar.scope = FSCalendarScopeMonth; // By default
7979
* Swift
8080

8181
```swift
82-
calendar.scope = .Month
82+
calendar.scope = .month
8383
```
8484

8585
![fscalendar-scope](https://cloud.githubusercontent.com/assets/5186464/12474251/aec94a32-c054-11e5-8b30-9e3d03d9a846.gif)
8686

8787
### To select more than one date
8888

89+
* Objective-C
90+
8991
```objective-c
90-
_calendar.allowsMultipleSelection = YES;
92+
calendar.allowsMultipleSelection = YES;
9193
```
9294

95+
* Swift
96+
97+
```swift
98+
calendar.allowsMultipleSelection = true;
99+
```
100+
101+
93102
![fscalendar-mulipleselection](https://cloud.githubusercontent.com/assets/5186464/9751497/368f55f6-56d8-11e5-9af5-0d09ba13f0eb.png)
94103

95104
### If you want `FSCalendar` to use `Monday` as the first column (or any other weekday)
96105

106+
* Objective-C
107+
97108
```objective-c
98109
_calendar.firstWeekday = 2;
99110
```
100111

112+
* Swift
113+
114+
```swift
115+
calendar.firstWeekday = 2
116+
```
117+
101118
![fscalendar---monday](https://cloud.githubusercontent.com/assets/5186464/8448782/c92505e4-1ffd-11e5-95c0-9bf3c8bec669.png)
102119

103120

104121
### The date format of header can be customized
105122

123+
* Objective-C
124+
106125
```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"
108133
```
109134

110135
![fscalendar---headerformat](https://cloud.githubusercontent.com/assets/5186464/8449322/15d79168-2003-11e5-997a-06c6721dd807.png)
111136

112137
### You can define the appearance
113138

139+
* Objective-c
140+
114141
```objective-c
115142
_calendar.appearance.weekdayTextColor = [UIColor redColor];
116143
_calendar.appearance.headerTitleColor = [UIColor redColor];
@@ -120,25 +147,39 @@ _calendar.appearance.todayColor = [UIColor orangeColor];
120147
_calendar.appearance.todaySelectionColor = [UIColor blackColor];
121148
```
122149

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+
123162
![fscalendar---colors](https://cloud.githubusercontent.com/assets/5186464/8449300/d55d1c7a-2002-11e5-8de6-be04f3783456.png)
124163

125164
### The day shape doesn't have to be a circle
126165

127-
* Objective - c
166+
* Objective-C
167+
128168
```objective-c
129-
_calendar.appearance.cellStyle = FSCalendarCellStyleRectangle;
169+
calendar.appearance.borderRadius = 0
130170
```
131171

132172
* Swift
173+
133174
```swift
134-
calendar.appearance.cellStyle = .Rectangle
175+
calendar.appearance.borderRadius = 0
135176
```
136177

137178
![fscalendar---rectangle](https://cloud.githubusercontent.com/assets/5186464/8449186/d38ea39c-2001-11e5-99f4-32fcd6120a01.png)
138179

139180
### `FSCalendar` can show subtitle for each day
140181

141-
* Objective - c
182+
* Objective-C
142183

143184
```objective-c
144185
// FSCalendarDataSource
@@ -152,7 +193,7 @@ calendar.appearance.cellStyle = .Rectangle
152193

153194
```swift
154195
// FSCalendarDataSource
155-
func calendar(calendar: FSCalendar!, subtitleForDate date: NSDate!) -> String! {
196+
func calendar(_ calendar: FSCalendar!, subtitleFor date: NSDate!) -> String! {
156197
return yourSubtitle
157198
}
158199
```
@@ -163,7 +204,7 @@ func calendar(calendar: FSCalendar!, subtitleForDate date: NSDate!) -> String! {
163204

164205
### And event dot for some days
165206

166-
* Objective - c
207+
* Objective-C
167208

168209
```objective-c
169210
// FSCalendarDataSource
@@ -198,7 +239,7 @@ func calendar(calendar: FSCalendar!, hasEventForDate date: NSDate!) -> Bool {
198239

199240
```swift
200241
// FSCalendarDataSource
201-
func calendar(calendar: FSCalendar!, imageForDate date: NSDate!) -> UIImage! {
242+
func calendar(_ calendar: FSCalendar!, imageFor date: NSDate!) -> UIImage! {
202243
return anyImage
203244
}
204245
```
@@ -207,7 +248,7 @@ func calendar(calendar: FSCalendar!, imageForDate date: NSDate!) -> UIImage! {
207248

208249
#### You can hide top and bottom borders
209250

210-
* Objective - c
251+
* Objective-C
211252

212253
```objective-c
213254
calendar.clipsToBounds = YES
@@ -285,9 +326,9 @@ func calendar(calendar: FSCalendar!, shouldSelectDate date: NSDate!) -> Bool {
285326
```
286327

287328

288-
### You will get notified when `FSCalendar` changes the month
329+
### You will get notified when `FSCalendar` changes the month or week
289330

290-
* Objective - c
331+
* Objective-C
291332

292333
```objective-c
293334
- (void)calendarCurrentMonthDidChange:(FSCalendar *)calendar
@@ -299,7 +340,7 @@ func calendar(calendar: FSCalendar!, shouldSelectDate date: NSDate!) -> Bool {
299340
* Swift
300341

301342
```swift
302-
func calendarCurrentMonthDidChange(calendar: FSCalendar!) {
343+
func calendarCurrentMonthDidChange(_ calendar: FSCalendar!) {
303344
// Do something
304345
}
305346
```

0 commit comments

Comments
 (0)