Update MoreUsage.md
This commit is contained in:
parent
6ee5595ba0
commit
dbca5eea04
75
MOREUSAGE.md
75
MOREUSAGE.md
|
|
@ -11,7 +11,7 @@ _calendar.scrollDirection = FSCalendarScrollDirectionVertical;
|
|||
* Swift
|
||||
|
||||
```swift
|
||||
calendar.scrollDirection = .Vertical
|
||||
calendar.scrollDirection = .vertical
|
||||
```
|
||||
|
||||

|
||||
|
|
@ -56,7 +56,7 @@ calendar.scrollDirection = .Horizontal
|
|||
|
||||
### For week mode
|
||||
|
||||
* Objective - c
|
||||
* Objective-C
|
||||
|
||||
```objective-c
|
||||
_calendar.scope = FSCalendarScopeWeek;
|
||||
|
|
@ -65,7 +65,7 @@ _calendar.scope = FSCalendarScopeWeek;
|
|||
* Swift
|
||||
|
||||
```swift
|
||||
calendar.scope = .Week
|
||||
calendar.scope = .week
|
||||
```
|
||||
|
||||
### For month mode
|
||||
|
|
@ -79,38 +79,65 @@ _calendar.scope = FSCalendarScopeMonth; // By default
|
|||
* Swift
|
||||
|
||||
```swift
|
||||
calendar.scope = .Month
|
||||
calendar.scope = .month
|
||||
```
|
||||
|
||||

|
||||
|
||||
### To select more than one date
|
||||
|
||||
* Objective-C
|
||||
|
||||
```objective-c
|
||||
_calendar.allowsMultipleSelection = YES;
|
||||
calendar.allowsMultipleSelection = YES;
|
||||
```
|
||||
|
||||
* Swift
|
||||
|
||||
```swift
|
||||
calendar.allowsMultipleSelection = true;
|
||||
```
|
||||
|
||||
|
||||

|
||||
|
||||
### If you want `FSCalendar` to use `Monday` as the first column (or any other weekday)
|
||||
|
||||
* Objective-C
|
||||
|
||||
```objective-c
|
||||
_calendar.firstWeekday = 2;
|
||||
```
|
||||
|
||||
* Swift
|
||||
|
||||
```swift
|
||||
calendar.firstWeekday = 2
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
### The date format of header can be customized
|
||||
|
||||
* Objective-C
|
||||
|
||||
```objective-c
|
||||
_calendar.appearance.headerDateFormat = @"MMM yy";
|
||||
calendar.appearance.headerDateFormat = @"MMM yy";
|
||||
```
|
||||
|
||||
* Swift
|
||||
|
||||
```swift
|
||||
calendar.appearance.headerDateFormat = "MMM yy"
|
||||
```
|
||||
|
||||

|
||||
|
||||
### You can define the appearance
|
||||
|
||||
* Objective-c
|
||||
|
||||
```objective-c
|
||||
_calendar.appearance.weekdayTextColor = [UIColor redColor];
|
||||
_calendar.appearance.headerTitleColor = [UIColor redColor];
|
||||
|
|
@ -120,25 +147,39 @@ _calendar.appearance.todayColor = [UIColor orangeColor];
|
|||
_calendar.appearance.todaySelectionColor = [UIColor blackColor];
|
||||
```
|
||||
|
||||
* Swift
|
||||
|
||||
```objective-c
|
||||
calendar.appearance.weekdayTextColor = UIColor.redColor
|
||||
calendar.appearance.headerTitleColor = UIColor.redColor
|
||||
calendar.appearance.eventColor = UIColor.greenColor
|
||||
calendar.appearance.selectionColor = UIColor.blueColor
|
||||
calendar.appearance.todayColor = UIColor.orangeColor
|
||||
calendar.appearance.todaySelectionColor = UIColor.blackColor
|
||||
```
|
||||
|
||||
|
||||

|
||||
|
||||
### The day shape doesn't have to be a circle
|
||||
|
||||
* Objective - c
|
||||
* Objective-C
|
||||
|
||||
```objective-c
|
||||
_calendar.appearance.cellStyle = FSCalendarCellStyleRectangle;
|
||||
calendar.appearance.borderRadius = 0
|
||||
```
|
||||
|
||||
* Swift
|
||||
|
||||
```swift
|
||||
calendar.appearance.cellStyle = .Rectangle
|
||||
calendar.appearance.borderRadius = 0
|
||||
```
|
||||
|
||||

|
||||
|
||||
### `FSCalendar` can show subtitle for each day
|
||||
|
||||
* Objective - c
|
||||
* Objective-C
|
||||
|
||||
```objective-c
|
||||
// FSCalendarDataSource
|
||||
|
|
@ -152,7 +193,7 @@ calendar.appearance.cellStyle = .Rectangle
|
|||
|
||||
```swift
|
||||
// FSCalendarDataSource
|
||||
func calendar(calendar: FSCalendar!, subtitleForDate date: NSDate!) -> String! {
|
||||
func calendar(_ calendar: FSCalendar!, subtitleFor date: NSDate!) -> String! {
|
||||
return yourSubtitle
|
||||
}
|
||||
```
|
||||
|
|
@ -163,7 +204,7 @@ func calendar(calendar: FSCalendar!, subtitleForDate date: NSDate!) -> String! {
|
|||
|
||||
### And event dot for some days
|
||||
|
||||
* Objective - c
|
||||
* Objective-C
|
||||
|
||||
```objective-c
|
||||
// FSCalendarDataSource
|
||||
|
|
@ -198,7 +239,7 @@ func calendar(calendar: FSCalendar!, hasEventForDate date: NSDate!) -> Bool {
|
|||
|
||||
```swift
|
||||
// FSCalendarDataSource
|
||||
func calendar(calendar: FSCalendar!, imageForDate date: NSDate!) -> UIImage! {
|
||||
func calendar(_ calendar: FSCalendar!, imageFor date: NSDate!) -> UIImage! {
|
||||
return anyImage
|
||||
}
|
||||
```
|
||||
|
|
@ -207,7 +248,7 @@ func calendar(calendar: FSCalendar!, imageForDate date: NSDate!) -> UIImage! {
|
|||
|
||||
#### You can hide top and bottom borders
|
||||
|
||||
* Objective - c
|
||||
* Objective-C
|
||||
|
||||
```objective-c
|
||||
calendar.clipsToBounds = YES
|
||||
|
|
@ -285,9 +326,9 @@ func calendar(calendar: FSCalendar!, shouldSelectDate date: NSDate!) -> Bool {
|
|||
```
|
||||
|
||||
|
||||
### You will get notified when `FSCalendar` changes the month
|
||||
### You will get notified when `FSCalendar` changes the month or week
|
||||
|
||||
* Objective - c
|
||||
* Objective-C
|
||||
|
||||
```objective-c
|
||||
- (void)calendarCurrentMonthDidChange:(FSCalendar *)calendar
|
||||
|
|
@ -299,7 +340,7 @@ func calendar(calendar: FSCalendar!, shouldSelectDate date: NSDate!) -> Bool {
|
|||
* Swift
|
||||
|
||||
```swift
|
||||
func calendarCurrentMonthDidChange(calendar: FSCalendar!) {
|
||||
func calendarCurrentMonthDidChange(_ calendar: FSCalendar!) {
|
||||
// Do something
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue