Compare commits
3 Commits
master
...
multiple-w
| Author | SHA1 | Date |
|---|---|---|
|
|
c896d67181 | |
|
|
eefdb9a673 | |
|
|
8cf046e30d |
|
|
@ -105,7 +105,7 @@
|
||||||
|
|
||||||
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
|
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
|
||||||
{
|
{
|
||||||
return [self.dateFormatter dateFromString:@"2020-07-08"];
|
return [self.dateFormatter dateFromString:@"2016-07-08"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
|
- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
|
||||||
|
|
|
||||||
|
|
@ -42,68 +42,68 @@ NS_ASSUME_NONNULL_END
|
||||||
if (self) {
|
if (self) {
|
||||||
self.title = @"FSCalendar";
|
self.title = @"FSCalendar";
|
||||||
|
|
||||||
self.fillDefaultColors = @{@"2020/10/08":[UIColor purpleColor],
|
self.fillDefaultColors = @{@"2015/10/08":[UIColor purpleColor],
|
||||||
@"2020/10/06":[UIColor greenColor],
|
@"2015/10/06":[UIColor greenColor],
|
||||||
@"2020/10/18":[UIColor cyanColor],
|
@"2015/10/18":[UIColor cyanColor],
|
||||||
@"2020/10/22":[UIColor yellowColor],
|
@"2015/10/22":[UIColor yellowColor],
|
||||||
@"2020/11/08":[UIColor purpleColor],
|
@"2015/11/08":[UIColor purpleColor],
|
||||||
@"2020/11/06":[UIColor greenColor],
|
@"2015/11/06":[UIColor greenColor],
|
||||||
@"2020/11/18":[UIColor cyanColor],
|
@"2015/11/18":[UIColor cyanColor],
|
||||||
@"2020/11/22":[UIColor yellowColor],
|
@"2015/11/22":[UIColor yellowColor],
|
||||||
@"2020/12/08":[UIColor purpleColor],
|
@"2015/12/08":[UIColor purpleColor],
|
||||||
@"2020/12/06":[UIColor greenColor],
|
@"2015/12/06":[UIColor greenColor],
|
||||||
@"2020/12/18":[UIColor cyanColor],
|
@"2015/12/18":[UIColor cyanColor],
|
||||||
@"2020/12/22":[UIColor magentaColor]};
|
@"2015/12/22":[UIColor magentaColor]};
|
||||||
|
|
||||||
self.fillSelectionColors = @{@"2020/10/08":[UIColor greenColor],
|
self.fillSelectionColors = @{@"2015/10/08":[UIColor greenColor],
|
||||||
@"2020/10/06":[UIColor purpleColor],
|
@"2015/10/06":[UIColor purpleColor],
|
||||||
@"2020/10/17":[UIColor grayColor],
|
@"2015/10/17":[UIColor grayColor],
|
||||||
@"2020/10/21":[UIColor cyanColor],
|
@"2015/10/21":[UIColor cyanColor],
|
||||||
@"2020/11/08":[UIColor greenColor],
|
@"2015/11/08":[UIColor greenColor],
|
||||||
@"2020/11/06":[UIColor purpleColor],
|
@"2015/11/06":[UIColor purpleColor],
|
||||||
@"2020/11/17":[UIColor grayColor],
|
@"2015/11/17":[UIColor grayColor],
|
||||||
@"2020/11/21":[UIColor cyanColor],
|
@"2015/11/21":[UIColor cyanColor],
|
||||||
@"2020/12/08":[UIColor greenColor],
|
@"2015/12/08":[UIColor greenColor],
|
||||||
@"2020/12/06":[UIColor purpleColor],
|
@"2015/12/06":[UIColor purpleColor],
|
||||||
@"2020/12/17":[UIColor grayColor],
|
@"2015/12/17":[UIColor grayColor],
|
||||||
@"2020/12/21":[UIColor cyanColor]};
|
@"2015/12/21":[UIColor cyanColor]};
|
||||||
|
|
||||||
self.borderDefaultColors = @{@"2020/10/08":[UIColor brownColor],
|
self.borderDefaultColors = @{@"2015/10/08":[UIColor brownColor],
|
||||||
@"2020/10/17":[UIColor magentaColor],
|
@"2015/10/17":[UIColor magentaColor],
|
||||||
@"2020/10/21":FSCalendarStandardSelectionColor,
|
@"2015/10/21":FSCalendarStandardSelectionColor,
|
||||||
@"2020/10/25":[UIColor blackColor],
|
@"2015/10/25":[UIColor blackColor],
|
||||||
@"2020/11/08":[UIColor brownColor],
|
@"2015/11/08":[UIColor brownColor],
|
||||||
@"2020/11/17":[UIColor magentaColor],
|
@"2015/11/17":[UIColor magentaColor],
|
||||||
@"2020/11/21":FSCalendarStandardSelectionColor,
|
@"2015/11/21":FSCalendarStandardSelectionColor,
|
||||||
@"2020/11/25":[UIColor blackColor],
|
@"2015/11/25":[UIColor blackColor],
|
||||||
@"2020/12/08":[UIColor brownColor],
|
@"2015/12/08":[UIColor brownColor],
|
||||||
@"2020/12/17":[UIColor magentaColor],
|
@"2015/12/17":[UIColor magentaColor],
|
||||||
@"2020/12/21":FSCalendarStandardSelectionColor,
|
@"2015/12/21":FSCalendarStandardSelectionColor,
|
||||||
@"2020/12/25":[UIColor blackColor]};
|
@"2015/12/25":[UIColor blackColor]};
|
||||||
|
|
||||||
self.borderSelectionColors = @{@"2020/10/08":[UIColor redColor],
|
self.borderSelectionColors = @{@"2015/10/08":[UIColor redColor],
|
||||||
@"2020/10/17":[UIColor purpleColor],
|
@"2015/10/17":[UIColor purpleColor],
|
||||||
@"2020/10/21":FSCalendarStandardSelectionColor,
|
@"2015/10/21":FSCalendarStandardSelectionColor,
|
||||||
@"2020/10/25":FSCalendarStandardTodayColor,
|
@"2015/10/25":FSCalendarStandardTodayColor,
|
||||||
@"2020/11/08":[UIColor redColor],
|
@"2015/11/08":[UIColor redColor],
|
||||||
@"2020/11/17":[UIColor purpleColor],
|
@"2015/11/17":[UIColor purpleColor],
|
||||||
@"2020/11/21":FSCalendarStandardSelectionColor,
|
@"2015/11/21":FSCalendarStandardSelectionColor,
|
||||||
@"2020/11/25":FSCalendarStandardTodayColor,
|
@"2015/11/25":FSCalendarStandardTodayColor,
|
||||||
@"2020/12/08":[UIColor redColor],
|
@"2015/12/08":[UIColor redColor],
|
||||||
@"2020/12/17":[UIColor purpleColor],
|
@"2015/12/17":[UIColor purpleColor],
|
||||||
@"2020/12/21":FSCalendarStandardSelectionColor,
|
@"2015/12/21":FSCalendarStandardSelectionColor,
|
||||||
@"2020/12/25":FSCalendarStandardTodayColor};
|
@"2015/12/25":FSCalendarStandardTodayColor};
|
||||||
|
|
||||||
|
|
||||||
self.datesWithEvent = @[@"2020-10-03",
|
self.datesWithEvent = @[@"2015-10-03",
|
||||||
@"2020-10-06",
|
@"2015-10-06",
|
||||||
@"2020-10-12",
|
@"2015-10-12",
|
||||||
@"2020-10-25"];
|
@"2015-10-25"];
|
||||||
|
|
||||||
self.datesWithMultipleEvents = @[@"2020-10-08",
|
self.datesWithMultipleEvents = @[@"2015-10-08",
|
||||||
@"2020-10-16",
|
@"2015-10-16",
|
||||||
@"2020-10-20",
|
@"2015-10-20",
|
||||||
@"2020-10-28"];
|
@"2015-10-28"];
|
||||||
|
|
||||||
|
|
||||||
self.gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
|
self.gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
|
||||||
|
|
@ -134,7 +134,7 @@ NS_ASSUME_NONNULL_END
|
||||||
[self.view addSubview:calendar];
|
[self.view addSubview:calendar];
|
||||||
self.calendar = calendar;
|
self.calendar = calendar;
|
||||||
|
|
||||||
[calendar setCurrentPage:[self.dateFormatter1 dateFromString:@"2020/10/03"] animated:NO];
|
[calendar setCurrentPage:[self.dateFormatter1 dateFromString:@"2015/10/03"] animated:NO];
|
||||||
|
|
||||||
UIBarButtonItem *todayItem = [[UIBarButtonItem alloc] initWithTitle:@"TODAY" style:UIBarButtonItemStylePlain target:self action:@selector(todayItemClicked:)];
|
UIBarButtonItem *todayItem = [[UIBarButtonItem alloc] initWithTitle:@"TODAY" style:UIBarButtonItemStylePlain target:self action:@selector(todayItemClicked:)];
|
||||||
self.navigationItem.rightBarButtonItem = todayItem;
|
self.navigationItem.rightBarButtonItem = todayItem;
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@
|
||||||
30A495521DCAD9E6000B2F31 /* FSCalendarWeekdayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarWeekdayView.h; sourceTree = "<group>"; };
|
30A495521DCAD9E6000B2F31 /* FSCalendarWeekdayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarWeekdayView.h; sourceTree = "<group>"; };
|
||||||
30A495531DCAD9E6000B2F31 /* FSCalendarWeekdayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarWeekdayView.m; sourceTree = "<group>"; };
|
30A495531DCAD9E6000B2F31 /* FSCalendarWeekdayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarWeekdayView.m; sourceTree = "<group>"; };
|
||||||
30B0BABF1B8D8E22004B9476 /* FSCalendar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendar.h; sourceTree = "<group>"; };
|
30B0BABF1B8D8E22004B9476 /* FSCalendar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendar.h; sourceTree = "<group>"; };
|
||||||
30B0BAC01B8D8E22004B9476 /* FSCalendar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = FSCalendar.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
30B0BAC01B8D8E22004B9476 /* FSCalendar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = FSCalendar.m; sourceTree = "<group>"; };
|
||||||
30B0BAC11B8D8E22004B9476 /* FSCalendarAppearance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarAppearance.h; sourceTree = "<group>"; };
|
30B0BAC11B8D8E22004B9476 /* FSCalendarAppearance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarAppearance.h; sourceTree = "<group>"; };
|
||||||
30B0BAC21B8D8E22004B9476 /* FSCalendarAppearance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarAppearance.m; sourceTree = "<group>"; };
|
30B0BAC21B8D8E22004B9476 /* FSCalendarAppearance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarAppearance.m; sourceTree = "<group>"; };
|
||||||
30B0BAC31B8D8E22004B9476 /* FSCalendarCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = FSCalendarCell.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
30B0BAC31B8D8E22004B9476 /* FSCalendarCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = FSCalendarCell.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
|
|
@ -149,6 +149,7 @@
|
||||||
30B0BAC51B8D8E22004B9476 /* FSCalendarDynamicHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarDynamicHeader.h; sourceTree = "<group>"; };
|
30B0BAC51B8D8E22004B9476 /* FSCalendarDynamicHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarDynamicHeader.h; sourceTree = "<group>"; };
|
||||||
30B0BAC61B8D8E22004B9476 /* FSCalendarHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarHeaderView.h; sourceTree = "<group>"; };
|
30B0BAC61B8D8E22004B9476 /* FSCalendarHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarHeaderView.h; sourceTree = "<group>"; };
|
||||||
30B0BAC71B8D8E22004B9476 /* FSCalendarHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarHeaderView.m; sourceTree = "<group>"; };
|
30B0BAC71B8D8E22004B9476 /* FSCalendarHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarHeaderView.m; sourceTree = "<group>"; };
|
||||||
|
30B0BACA1B8D8E22004B9476 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
30CEF8FE1C950C1F008EAFB1 /* FSCalendarTransitionCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarTransitionCoordinator.h; sourceTree = "<group>"; };
|
30CEF8FE1C950C1F008EAFB1 /* FSCalendarTransitionCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarTransitionCoordinator.h; sourceTree = "<group>"; };
|
||||||
30CEF8FF1C950C1F008EAFB1 /* FSCalendarTransitionCoordinator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarTransitionCoordinator.m; sourceTree = "<group>"; };
|
30CEF8FF1C950C1F008EAFB1 /* FSCalendarTransitionCoordinator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarTransitionCoordinator.m; sourceTree = "<group>"; };
|
||||||
30D55B0E1C90240000BB43D5 /* HidePlaceholderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HidePlaceholderViewController.h; sourceTree = SOURCE_ROOT; };
|
30D55B0E1C90240000BB43D5 /* HidePlaceholderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HidePlaceholderViewController.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
|
@ -161,7 +162,6 @@
|
||||||
30FCB3951BAAD112002B87AD /* FSCalendarStickyHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarStickyHeader.m; sourceTree = "<group>"; };
|
30FCB3951BAAD112002B87AD /* FSCalendarStickyHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarStickyHeader.m; sourceTree = "<group>"; };
|
||||||
50F2ADE6216D954A00CC481F /* FSCalendarSeparatorDecorationView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FSCalendarSeparatorDecorationView.h; sourceTree = "<group>"; };
|
50F2ADE6216D954A00CC481F /* FSCalendarSeparatorDecorationView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FSCalendarSeparatorDecorationView.h; sourceTree = "<group>"; };
|
||||||
50F2ADE7216D954A00CC481F /* FSCalendarSeparatorDecorationView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FSCalendarSeparatorDecorationView.m; sourceTree = "<group>"; };
|
50F2ADE7216D954A00CC481F /* FSCalendarSeparatorDecorationView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FSCalendarSeparatorDecorationView.m; sourceTree = "<group>"; };
|
||||||
9C88197F25F26B2F00E180CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
|
||||||
EE0D7FC71B89C5D3003C287B /* FSCalendarExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FSCalendarExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
EE0D7FC71B89C5D3003C287B /* FSCalendarExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FSCalendarExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
EE0D7FCB1B89C5D3003C287B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
EE0D7FCB1B89C5D3003C287B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
EE52AE161B91E68A00016662 /* FSCalendarScopeExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarScopeExampleViewController.h; sourceTree = SOURCE_ROOT; };
|
EE52AE161B91E68A00016662 /* FSCalendarScopeExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarScopeExampleViewController.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
|
@ -261,7 +261,6 @@
|
||||||
30B0BABC1B8D8E22004B9476 /* FSCalendar */ = {
|
30B0BABC1B8D8E22004B9476 /* FSCalendar */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
9C88197F25F26B2F00E180CD /* Info.plist */,
|
|
||||||
30B0BABF1B8D8E22004B9476 /* FSCalendar.h */,
|
30B0BABF1B8D8E22004B9476 /* FSCalendar.h */,
|
||||||
30B0BAC01B8D8E22004B9476 /* FSCalendar.m */,
|
30B0BAC01B8D8E22004B9476 /* FSCalendar.m */,
|
||||||
30B0BAC11B8D8E22004B9476 /* FSCalendarAppearance.h */,
|
30B0BAC11B8D8E22004B9476 /* FSCalendarAppearance.h */,
|
||||||
|
|
@ -293,11 +292,20 @@
|
||||||
309225381B905C4300123031 /* FSCalendarConstants.h */,
|
309225381B905C4300123031 /* FSCalendarConstants.h */,
|
||||||
309225391B905C4300123031 /* FSCalendarConstants.m */,
|
309225391B905C4300123031 /* FSCalendarConstants.m */,
|
||||||
30B0BAC51B8D8E22004B9476 /* FSCalendarDynamicHeader.h */,
|
30B0BAC51B8D8E22004B9476 /* FSCalendarDynamicHeader.h */,
|
||||||
|
30B0BAF31B8D9A91004B9476 /* Supporting Files */,
|
||||||
);
|
);
|
||||||
name = FSCalendar;
|
name = FSCalendar;
|
||||||
path = ../FSCalendar;
|
path = ../FSCalendar;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
30B0BAF31B8D9A91004B9476 /* Supporting Files */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
30B0BACA1B8D8E22004B9476 /* Info.plist */,
|
||||||
|
);
|
||||||
|
name = "Supporting Files";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
30D55B0D1C9023E400BB43D5 /* Hide Placeholders */ = {
|
30D55B0D1C9023E400BB43D5 /* Hide Placeholders */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
|
@ -580,7 +588,7 @@
|
||||||
};
|
};
|
||||||
buildConfigurationList = EE0D7FC21B89C5D3003C287B /* Build configuration list for PBXProject "FSCalendar" */;
|
buildConfigurationList = EE0D7FC21B89C5D3003C287B /* Build configuration list for PBXProject "FSCalendar" */;
|
||||||
compatibilityVersion = "Xcode 3.2";
|
compatibilityVersion = "Xcode 3.2";
|
||||||
developmentRegion = en;
|
developmentRegion = English;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
knownRegions = (
|
knownRegions = (
|
||||||
en,
|
en,
|
||||||
|
|
@ -886,7 +894,7 @@
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
DEVELOPMENT_TEAM = HZF422TY46;
|
DEVELOPMENT_TEAM = HZF422TY46;
|
||||||
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
|
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSCalendarExample;
|
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSCalendarExample;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|
@ -900,7 +908,7 @@
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
DEVELOPMENT_TEAM = HZF422TY46;
|
DEVELOPMENT_TEAM = HZF422TY46;
|
||||||
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
|
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSCalendarExample;
|
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSCalendarExample;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|
@ -923,9 +931,8 @@
|
||||||
);
|
);
|
||||||
INFOPLIST_FILE = "$(SRCROOT)/../FSCalendar/Info.plist";
|
INFOPLIST_FILE = "$(SRCROOT)/../FSCalendar/Info.plist";
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
MARKETING_VERSION = 2.8.3;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSCalendar;
|
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSCalendar;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
|
|
@ -946,9 +953,8 @@
|
||||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
INFOPLIST_FILE = "$(SRCROOT)/../FSCalendar/Info.plist";
|
INFOPLIST_FILE = "$(SRCROOT)/../FSCalendar/Info.plist";
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
MARKETING_VERSION = 2.8.3;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSCalendar;
|
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSCalendar;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>IDEDidComputeMac32BitWarning</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
|
|
@ -1,98 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Scheme
|
|
||||||
LastUpgradeVersion = "1140"
|
|
||||||
version = "1.3">
|
|
||||||
<BuildAction
|
|
||||||
parallelizeBuildables = "YES"
|
|
||||||
buildImplicitDependencies = "YES">
|
|
||||||
<BuildActionEntries>
|
|
||||||
<BuildActionEntry
|
|
||||||
buildForTesting = "YES"
|
|
||||||
buildForRunning = "YES"
|
|
||||||
buildForProfiling = "YES"
|
|
||||||
buildForArchiving = "YES"
|
|
||||||
buildForAnalyzing = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "EE0D7FC61B89C5D3003C287B"
|
|
||||||
BuildableName = "FSCalendarExample.app"
|
|
||||||
BlueprintName = "FSCalendarExample"
|
|
||||||
ReferencedContainer = "container:FSCalendar.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildActionEntry>
|
|
||||||
</BuildActionEntries>
|
|
||||||
</BuildAction>
|
|
||||||
<TestAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
||||||
<Testables>
|
|
||||||
<TestableReference
|
|
||||||
skipped = "NO">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "30671DC61D6D574C00BCFC4E"
|
|
||||||
BuildableName = "FSCalendarTests.xctest"
|
|
||||||
BlueprintName = "FSCalendarTests"
|
|
||||||
ReferencedContainer = "container:FSCalendar.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</TestableReference>
|
|
||||||
<TestableReference
|
|
||||||
skipped = "NO">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "F9384A611E3ACEFB001601E0"
|
|
||||||
BuildableName = "FSCalendarExampleUITests.xctest"
|
|
||||||
BlueprintName = "FSCalendarExampleUITests"
|
|
||||||
ReferencedContainer = "container:FSCalendar.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</TestableReference>
|
|
||||||
</Testables>
|
|
||||||
</TestAction>
|
|
||||||
<LaunchAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
launchStyle = "0"
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
|
||||||
debugDocumentVersioning = "YES"
|
|
||||||
debugServiceExtension = "internal"
|
|
||||||
allowLocationSimulation = "YES">
|
|
||||||
<BuildableProductRunnable
|
|
||||||
runnableDebuggingMode = "0">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "EE0D7FC61B89C5D3003C287B"
|
|
||||||
BuildableName = "FSCalendarExample.app"
|
|
||||||
BlueprintName = "FSCalendarExample"
|
|
||||||
ReferencedContainer = "container:FSCalendar.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildableProductRunnable>
|
|
||||||
</LaunchAction>
|
|
||||||
<ProfileAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
||||||
savedToolIdentifier = ""
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
debugDocumentVersioning = "YES">
|
|
||||||
<BuildableProductRunnable
|
|
||||||
runnableDebuggingMode = "0">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "EE0D7FC61B89C5D3003C287B"
|
|
||||||
BuildableName = "FSCalendarExample.app"
|
|
||||||
BlueprintName = "FSCalendarExample"
|
|
||||||
ReferencedContainer = "container:FSCalendar.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildableProductRunnable>
|
|
||||||
</ProfileAction>
|
|
||||||
<AnalyzeAction
|
|
||||||
buildConfiguration = "Debug">
|
|
||||||
</AnalyzeAction>
|
|
||||||
<ArchiveAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
revealArchiveInOrganizer = "YES">
|
|
||||||
</ArchiveAction>
|
|
||||||
</Scheme>
|
|
||||||
|
|
@ -43,14 +43,14 @@
|
||||||
[[application.tables elementBoundByIndex:0].cells[@"DIY Example, Feature!"] tap];
|
[[application.tables elementBoundByIndex:0].cells[@"DIY Example, Feature!"] tap];
|
||||||
XCUIElement *calendar = application.otherElements[@"calendar"];
|
XCUIElement *calendar = application.otherElements[@"calendar"];
|
||||||
|
|
||||||
XCUICoordinate *swipeStart = [calendar coordinateWithNormalizedOffset:CGVectorMake(0.8/7.0, 0.5)];
|
XCUICoordinate *swipeStart = [calendar coordinateWithNormalizedOffset:CGVectorMake(0.5/7.0, 0.5)];
|
||||||
XCUICoordinate *swipeEnd = [calendar coordinateWithNormalizedOffset:CGVectorMake(6.5/7.0, 0.5)];
|
XCUICoordinate *swipeEnd = [calendar coordinateWithNormalizedOffset:CGVectorMake(6.5/7.0, 0.5)];
|
||||||
[swipeStart pressForDuration:0.8 thenDragToCoordinate:swipeEnd];
|
[swipeStart pressForDuration:0.8 thenDragToCoordinate:swipeEnd];
|
||||||
|
|
||||||
[calendar swipeUp];
|
[calendar swipeUp];
|
||||||
[calendar swipeLeft];
|
[calendar swipeLeft];
|
||||||
|
|
||||||
swipeStart = [calendar coordinateWithNormalizedOffset:CGVectorMake(0.8/7.0, 0.75)];
|
swipeStart = [calendar coordinateWithNormalizedOffset:CGVectorMake(0.5/7.0, 0.75)];
|
||||||
swipeEnd = [calendar coordinateWithNormalizedOffset:CGVectorMake(6.5/7.0, 0.75)];
|
swipeEnd = [calendar coordinateWithNormalizedOffset:CGVectorMake(6.5/7.0, 0.75)];
|
||||||
[swipeStart pressForDuration:0.8 thenDragToCoordinate:swipeEnd];
|
[swipeStart pressForDuration:0.8 thenDragToCoordinate:swipeEnd];
|
||||||
[calendar swipeDown];
|
[calendar swipeDown];
|
||||||
|
|
@ -64,8 +64,8 @@
|
||||||
{
|
{
|
||||||
XCUIApplication *application = [[XCUIApplication alloc] init];
|
XCUIApplication *application = [[XCUIApplication alloc] init];
|
||||||
[[application.tables elementBoundByIndex:0].cells[@"Prev-Next Buttons"] tap];
|
[[application.tables elementBoundByIndex:0].cells[@"Prev-Next Buttons"] tap];
|
||||||
XCUIElement *prevButton = [application.buttons elementBoundByIndex:1];
|
XCUIElement *prevButton = [application.buttons elementBoundByIndex:2];
|
||||||
XCUIElement *nextButton = [application.buttons elementBoundByIndex:2];
|
XCUIElement *nextButton = [application.buttons elementBoundByIndex:3];
|
||||||
NSInteger count = 3;
|
NSInteger count = 3;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
[prevButton tap];
|
[prevButton tap];
|
||||||
|
|
@ -199,7 +199,7 @@
|
||||||
CGVector vector1 = CGVectorMake(columnWidth * 3.5, cellStart + rowHeight * 2.5);
|
CGVector vector1 = CGVectorMake(columnWidth * 3.5, cellStart + rowHeight * 2.5);
|
||||||
CGVector vector2 = CGVectorMake(columnWidth * 4.5, cellStart + rowHeight * 2.5);
|
CGVector vector2 = CGVectorMake(columnWidth * 4.5, cellStart + rowHeight * 2.5);
|
||||||
|
|
||||||
XCUIElement *configureButton = [application.buttons elementBoundByIndex:1];
|
XCUIElement *configureButton = [application.buttons elementBoundByIndex:2];
|
||||||
|
|
||||||
[NSThread sleepForTimeInterval:0.5];
|
[NSThread sleepForTimeInterval:0.5];
|
||||||
[configureButton tap];
|
[configureButton tap];
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ NS_ASSUME_NONNULL_END
|
||||||
if ([[UIDevice currentDevice].model hasPrefix:@"iPad"]) {
|
if ([[UIDevice currentDevice].model hasPrefix:@"iPad"]) {
|
||||||
self.calendarHeightConstraint.constant = 400;
|
self.calendarHeightConstraint.constant = 400;
|
||||||
}
|
}
|
||||||
|
[self.calendar selectDate:[NSDate date] scrollToDate:YES];
|
||||||
|
|
||||||
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self.calendar action:@selector(handleScopeGesture:)];
|
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self.calendar action:@selector(handleScopeGesture:)];
|
||||||
panGesture.delegate = self;
|
panGesture.delegate = self;
|
||||||
|
|
@ -64,8 +65,6 @@ NS_ASSUME_NONNULL_END
|
||||||
self.calendar.placeholderType = FSCalendarPlaceholderTypeNone;
|
self.calendar.placeholderType = FSCalendarPlaceholderTypeNone;
|
||||||
self.calendar.scope = FSCalendarScopeWeek;
|
self.calendar.scope = FSCalendarScopeWeek;
|
||||||
|
|
||||||
[self.calendar selectDate:[NSDate date] scrollToDate:YES];
|
|
||||||
|
|
||||||
// For UITest
|
// For UITest
|
||||||
self.calendar.accessibilityIdentifier = @"calendar";
|
self.calendar.accessibilityIdentifier = @"calendar";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,13 +114,20 @@ NS_ASSUME_NONNULL_END
|
||||||
self.dateFormatter = [[NSDateFormatter alloc] init];
|
self.dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
self.dateFormatter.dateFormat = @"yyyy-MM-dd";
|
self.dateFormatter.dateFormat = @"yyyy-MM-dd";
|
||||||
|
|
||||||
self.minimumDate = [self.dateFormatter dateFromString:@"2020-02-03"];
|
self.minimumDate = [self.dateFormatter dateFromString:@"2016-02-03"];
|
||||||
self.maximumDate = [self.dateFormatter dateFromString:@"2023-04-10"];
|
self.maximumDate = [self.dateFormatter dateFromString:@"2021-04-10"];
|
||||||
|
|
||||||
self.calendar.accessibilityIdentifier = @"calendar";
|
self.calendar.accessibilityIdentifier = @"calendar";
|
||||||
|
|
||||||
[self loadCalendarEvents];
|
[self loadCalendarEvents];
|
||||||
|
|
||||||
|
/*
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
self.minimumDate = [self.dateFormatter dateFromString:@"2015-02-01"];
|
||||||
|
self.maximumDate = [self.dateFormatter dateFromString:@"2015-06-10"];
|
||||||
|
[self.calendar reloadData];
|
||||||
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning
|
- (void)didReceiveMemoryWarning
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ NS_ASSUME_NONNULL_END
|
||||||
calendar.delegate = self;
|
calendar.delegate = self;
|
||||||
calendar.placeholderType = FSCalendarPlaceholderTypeNone;
|
calendar.placeholderType = FSCalendarPlaceholderTypeNone;
|
||||||
calendar.adjustsBoundingRectWhenChangingMonths = YES;
|
calendar.adjustsBoundingRectWhenChangingMonths = YES;
|
||||||
calendar.currentPage = [self.dateFormatter dateFromString:@"2020-06-01"];
|
calendar.currentPage = [self.dateFormatter dateFromString:@"2016-06-01"];
|
||||||
calendar.firstWeekday = 2;
|
calendar.firstWeekday = 2;
|
||||||
calendar.scrollDirection = FSCalendarScrollDirectionVertical;
|
calendar.scrollDirection = FSCalendarScrollDirectionVertical;
|
||||||
[self.view addSubview:calendar];
|
[self.view addSubview:calendar];
|
||||||
|
|
@ -126,12 +126,12 @@ NS_ASSUME_NONNULL_END
|
||||||
|
|
||||||
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
|
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
|
||||||
{
|
{
|
||||||
return [self.dateFormatter dateFromString:@"2020-01-08"];
|
return [self.dateFormatter dateFromString:@"2016-01-08"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
|
- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
|
||||||
{
|
{
|
||||||
return [self.dateFormatter dateFromString:@"2023-10-08"];
|
return [self.dateFormatter dateFromString:@"2018-10-08"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@ NS_ASSUME_NONNULL_END
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
self.title = @"FSCalendar";
|
self.title = @"FSCalendar";
|
||||||
self.images = @{@"2020/11/01":[UIImage imageNamed:@"icon_cat"],
|
self.images = @{@"2016/11/01":[UIImage imageNamed:@"icon_cat"],
|
||||||
@"2020/11/05":[UIImage imageNamed:@"icon_footprint"],
|
@"2016/11/05":[UIImage imageNamed:@"icon_footprint"],
|
||||||
@"2020/11/20":[UIImage imageNamed:@"icon_cat"],
|
@"2016/11/20":[UIImage imageNamed:@"icon_cat"],
|
||||||
@"2020/11/07":[UIImage imageNamed:@"icon_footprint"]};
|
@"2016/11/07":[UIImage imageNamed:@"icon_footprint"]};
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_END
|
||||||
self.dateFormatter.dateFormat = @"yyyy/MM/dd";
|
self.dateFormatter.dateFormat = @"yyyy/MM/dd";
|
||||||
|
|
||||||
|
|
||||||
// [self.calendar selectDate:[self.dateFormatter dateFromString:@"2020/02/03"]];
|
// [self.calendar selectDate:[self.dateFormatter dateFromString:@"2016/02/03"]];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
|
@ -115,12 +115,12 @@ NS_ASSUME_NONNULL_END
|
||||||
|
|
||||||
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
|
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
|
||||||
{
|
{
|
||||||
return [self.dateFormatter dateFromString:@"2020/10/01"];
|
return [self.dateFormatter dateFromString:@"2016/10/01"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
|
- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
|
||||||
{
|
{
|
||||||
return [self.dateFormatter dateFromString:@"2023/10/10"];
|
return [self.dateFormatter dateFromString:@"2017/10/10"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@
|
||||||
|
|
||||||
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
|
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
|
||||||
{
|
{
|
||||||
return [self.dateFormatter dateFromString:@"2020-07-08"];
|
return [self.dateFormatter dateFromString:@"2016-07-08"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
|
- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
|
||||||
|
|
|
||||||
|
|
@ -54,18 +54,18 @@
|
||||||
|
|
||||||
self.calendar.appearance.caseOptions = FSCalendarCaseOptionsHeaderUsesUpperCase|FSCalendarCaseOptionsWeekdayUsesUpperCase;
|
self.calendar.appearance.caseOptions = FSCalendarCaseOptionsHeaderUsesUpperCase|FSCalendarCaseOptionsWeekdayUsesUpperCase;
|
||||||
|
|
||||||
self.datesShouldNotBeSelected = @[@"2020/08/07",
|
self.datesShouldNotBeSelected = @[@"2016/08/07",
|
||||||
@"2020/09/07",
|
@"2016/09/07",
|
||||||
@"2020/10/07",
|
@"2016/10/07",
|
||||||
@"2020/11/07",
|
@"2016/11/07",
|
||||||
@"2020/12/07",
|
@"2016/12/07",
|
||||||
@"2020/01/07",
|
@"2016/01/07",
|
||||||
@"2020/02/07"];
|
@"2016/02/07"];
|
||||||
|
|
||||||
self.datesWithEvent = @[@"2020-12-03",
|
self.datesWithEvent = @[@"2016-12-03",
|
||||||
@"2020-12-07",
|
@"2016-12-07",
|
||||||
@"2020-12-15",
|
@"2016-12-15",
|
||||||
@"2020-12-25"];
|
@"2016-12-25"];
|
||||||
|
|
||||||
self.lunarFormatter = [[LunarFormatter alloc] init];
|
self.lunarFormatter = [[LunarFormatter alloc] init];
|
||||||
}
|
}
|
||||||
|
|
@ -81,8 +81,7 @@
|
||||||
if ([[UIDevice currentDevice].model hasPrefix:@"iPad"]) {
|
if ([[UIDevice currentDevice].model hasPrefix:@"iPad"]) {
|
||||||
self.calendarHeightConstraint.constant = 400;
|
self.calendarHeightConstraint.constant = 400;
|
||||||
}
|
}
|
||||||
self.calendar.today = [self.dateFormatter1 dateFromString:@"2020/11/19"];
|
[self.calendar selectDate:[self.dateFormatter1 dateFromString:@"2016/12/05"] scrollToDate:YES];
|
||||||
// [self.calendar selectDate:[self.dateFormatter1 dateFromString:@"2020/11/09"] scrollToDate:YES];
|
|
||||||
|
|
||||||
self.calendar.accessibilityIdentifier = @"calendar";
|
self.calendar.accessibilityIdentifier = @"calendar";
|
||||||
|
|
||||||
|
|
@ -118,12 +117,12 @@
|
||||||
|
|
||||||
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
|
- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
|
||||||
{
|
{
|
||||||
return [self.dateFormatter1 dateFromString:@"2020/10/01"];
|
return [self.dateFormatter1 dateFromString:@"2016/10/01"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
|
- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
|
||||||
{
|
{
|
||||||
return [self.dateFormatter1 dateFromString:@"2023/05/31"];
|
return [self.dateFormatter1 dateFromString:@"2018/05/31"];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - FSCalendarDelegate
|
#pragma mark - FSCalendarDelegate
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
30F4C9471E07C3AD00D2EC4D /* FSCalendarStickyHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F4C9351E07C3AD00D2EC4D /* FSCalendarStickyHeader.m */; };
|
30F4C9471E07C3AD00D2EC4D /* FSCalendarStickyHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F4C9351E07C3AD00D2EC4D /* FSCalendarStickyHeader.m */; };
|
||||||
30F4C9481E07C3AD00D2EC4D /* FSCalendarWeekdayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F4C9371E07C3AD00D2EC4D /* FSCalendarWeekdayView.m */; };
|
30F4C9481E07C3AD00D2EC4D /* FSCalendarWeekdayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F4C9371E07C3AD00D2EC4D /* FSCalendarWeekdayView.m */; };
|
||||||
50F2ADFA216DA21000CC481F /* FSCalendarSeparatorDecorationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 50F2ADF8216DA20F00CC481F /* FSCalendarSeparatorDecorationView.m */; };
|
50F2ADFA216DA21000CC481F /* FSCalendarSeparatorDecorationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 50F2ADF8216DA20F00CC481F /* FSCalendarSeparatorDecorationView.m */; };
|
||||||
|
CC7D16F72135D56100445693 /* FSWeeksSelectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC7D16F62135D56100445693 /* FSWeeksSelectionCell.swift */; };
|
||||||
EE0954AD1B97DDE0007F6964 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0954AC1B97DDE0007F6964 /* AppDelegate.swift */; };
|
EE0954AD1B97DDE0007F6964 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0954AC1B97DDE0007F6964 /* AppDelegate.swift */; };
|
||||||
EE0954AF1B97DDE0007F6964 /* InterfaceBuilderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0954AE1B97DDE0007F6964 /* InterfaceBuilderViewController.swift */; };
|
EE0954AF1B97DDE0007F6964 /* InterfaceBuilderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0954AE1B97DDE0007F6964 /* InterfaceBuilderViewController.swift */; };
|
||||||
EE0954B21B97DDE0007F6964 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE0954B01B97DDE0007F6964 /* Main.storyboard */; };
|
EE0954B21B97DDE0007F6964 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE0954B01B97DDE0007F6964 /* Main.storyboard */; };
|
||||||
|
|
@ -57,12 +58,12 @@
|
||||||
305282C81E1608A100CC2877 /* FSCalendarScopeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSCalendarScopeViewController.swift; sourceTree = "<group>"; };
|
305282C81E1608A100CC2877 /* FSCalendarScopeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSCalendarScopeViewController.swift; sourceTree = "<group>"; };
|
||||||
30D458E81DB4E2DB00B163C7 /* LoadViewExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadViewExampleViewController.swift; sourceTree = "<group>"; };
|
30D458E81DB4E2DB00B163C7 /* LoadViewExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadViewExampleViewController.swift; sourceTree = "<group>"; };
|
||||||
30F4C9191E07C3AD00D2EC4D /* FSCalendar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendar.h; sourceTree = "<group>"; };
|
30F4C9191E07C3AD00D2EC4D /* FSCalendar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendar.h; sourceTree = "<group>"; };
|
||||||
30F4C91A1E07C3AD00D2EC4D /* FSCalendar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendar.m; sourceTree = "<group>"; };
|
30F4C91A1E07C3AD00D2EC4D /* FSCalendar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendar.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||||
30F4C91D1E07C3AD00D2EC4D /* FSCalendarAppearance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarAppearance.h; sourceTree = "<group>"; };
|
30F4C91D1E07C3AD00D2EC4D /* FSCalendarAppearance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarAppearance.h; sourceTree = "<group>"; };
|
||||||
30F4C91E1E07C3AD00D2EC4D /* FSCalendarAppearance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarAppearance.m; sourceTree = "<group>"; };
|
30F4C91E1E07C3AD00D2EC4D /* FSCalendarAppearance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarAppearance.m; sourceTree = "<group>"; };
|
||||||
30F4C91F1E07C3AD00D2EC4D /* FSCalendarCalculator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarCalculator.h; sourceTree = "<group>"; };
|
30F4C91F1E07C3AD00D2EC4D /* FSCalendarCalculator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarCalculator.h; sourceTree = "<group>"; };
|
||||||
30F4C9201E07C3AD00D2EC4D /* FSCalendarCalculator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarCalculator.m; sourceTree = "<group>"; };
|
30F4C9201E07C3AD00D2EC4D /* FSCalendarCalculator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarCalculator.m; sourceTree = "<group>"; };
|
||||||
30F4C9211E07C3AD00D2EC4D /* FSCalendarCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarCell.h; sourceTree = "<group>"; };
|
30F4C9211E07C3AD00D2EC4D /* FSCalendarCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarCell.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
30F4C9221E07C3AD00D2EC4D /* FSCalendarCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarCell.m; sourceTree = "<group>"; };
|
30F4C9221E07C3AD00D2EC4D /* FSCalendarCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarCell.m; sourceTree = "<group>"; };
|
||||||
30F4C9231E07C3AD00D2EC4D /* FSCalendarCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarCollectionView.h; sourceTree = "<group>"; };
|
30F4C9231E07C3AD00D2EC4D /* FSCalendarCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarCollectionView.h; sourceTree = "<group>"; };
|
||||||
30F4C9241E07C3AD00D2EC4D /* FSCalendarCollectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarCollectionView.m; sourceTree = "<group>"; };
|
30F4C9241E07C3AD00D2EC4D /* FSCalendarCollectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarCollectionView.m; sourceTree = "<group>"; };
|
||||||
|
|
@ -84,6 +85,7 @@
|
||||||
30F4C9361E07C3AD00D2EC4D /* FSCalendarWeekdayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarWeekdayView.h; sourceTree = "<group>"; };
|
30F4C9361E07C3AD00D2EC4D /* FSCalendarWeekdayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarWeekdayView.h; sourceTree = "<group>"; };
|
||||||
30F4C9371E07C3AD00D2EC4D /* FSCalendarWeekdayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarWeekdayView.m; sourceTree = "<group>"; };
|
30F4C9371E07C3AD00D2EC4D /* FSCalendarWeekdayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarWeekdayView.m; sourceTree = "<group>"; };
|
||||||
30F4C9381E07C3AD00D2EC4D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
30F4C9381E07C3AD00D2EC4D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
CC7D16F62135D56100445693 /* FSWeeksSelectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FSWeeksSelectionCell.swift; sourceTree = "<group>"; };
|
||||||
50F2ADF8216DA20F00CC481F /* FSCalendarSeparatorDecorationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarSeparatorDecorationView.m; sourceTree = "<group>"; };
|
50F2ADF8216DA20F00CC481F /* FSCalendarSeparatorDecorationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarSeparatorDecorationView.m; sourceTree = "<group>"; };
|
||||||
50F2ADF9216DA21000CC481F /* FSCalendarSeparatorDecorationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarSeparatorDecorationView.h; sourceTree = "<group>"; };
|
50F2ADF9216DA21000CC481F /* FSCalendarSeparatorDecorationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarSeparatorDecorationView.h; sourceTree = "<group>"; };
|
||||||
EE0954A71B97DDE0007F6964 /* FSCalendarSwiftExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FSCalendarSwiftExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
EE0954A71B97DDE0007F6964 /* FSCalendarSwiftExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FSCalendarSwiftExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
|
@ -191,6 +193,7 @@
|
||||||
30031AA91DCEA83200FC34FE /* DIYCalendarCell.swift */,
|
30031AA91DCEA83200FC34FE /* DIYCalendarCell.swift */,
|
||||||
3024AF161E164F8C008B6001 /* DelegateAppearanceViewController.swift */,
|
3024AF161E164F8C008B6001 /* DelegateAppearanceViewController.swift */,
|
||||||
305282C81E1608A100CC2877 /* FSCalendarScopeViewController.swift */,
|
305282C81E1608A100CC2877 /* FSCalendarScopeViewController.swift */,
|
||||||
|
CC7D16F62135D56100445693 /* FSWeeksSelectionCell.swift */,
|
||||||
EE0954AE1B97DDE0007F6964 /* InterfaceBuilderViewController.swift */,
|
EE0954AE1B97DDE0007F6964 /* InterfaceBuilderViewController.swift */,
|
||||||
F9DE053A1E3CCAE800902F7D /* CalendarConfigViewController.swift */,
|
F9DE053A1E3CCAE800902F7D /* CalendarConfigViewController.swift */,
|
||||||
30D458E81DB4E2DB00B163C7 /* LoadViewExampleViewController.swift */,
|
30D458E81DB4E2DB00B163C7 /* LoadViewExampleViewController.swift */,
|
||||||
|
|
@ -271,7 +274,7 @@
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
EE0954A61B97DDE0007F6964 = {
|
EE0954A61B97DDE0007F6964 = {
|
||||||
CreatedOnToolsVersion = 6.4;
|
CreatedOnToolsVersion = 6.4;
|
||||||
DevelopmentTeam = HZF422TY46;
|
DevelopmentTeam = SW5SL8G723;
|
||||||
LastSwiftMigration = 0900;
|
LastSwiftMigration = 0900;
|
||||||
};
|
};
|
||||||
F9CB483C1E406A9200C92065 = {
|
F9CB483C1E406A9200C92065 = {
|
||||||
|
|
@ -288,7 +291,6 @@
|
||||||
developmentRegion = English;
|
developmentRegion = English;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
knownRegions = (
|
knownRegions = (
|
||||||
English,
|
|
||||||
en,
|
en,
|
||||||
Base,
|
Base,
|
||||||
);
|
);
|
||||||
|
|
@ -349,6 +351,7 @@
|
||||||
30F4C9481E07C3AD00D2EC4D /* FSCalendarWeekdayView.m in Sources */,
|
30F4C9481E07C3AD00D2EC4D /* FSCalendarWeekdayView.m in Sources */,
|
||||||
30F4C93E1E07C3AD00D2EC4D /* FSCalendarCell.m in Sources */,
|
30F4C93E1E07C3AD00D2EC4D /* FSCalendarCell.m in Sources */,
|
||||||
30D458E91DB4E2DB00B163C7 /* LoadViewExampleViewController.swift in Sources */,
|
30D458E91DB4E2DB00B163C7 /* LoadViewExampleViewController.swift in Sources */,
|
||||||
|
CC7D16F72135D56100445693 /* FSWeeksSelectionCell.swift in Sources */,
|
||||||
30031AAA1DCEA83200FC34FE /* DIYCalendarCell.swift in Sources */,
|
30031AAA1DCEA83200FC34FE /* DIYCalendarCell.swift in Sources */,
|
||||||
EE0954AD1B97DDE0007F6964 /* AppDelegate.swift in Sources */,
|
EE0954AD1B97DDE0007F6964 /* AppDelegate.swift in Sources */,
|
||||||
EE0954AF1B97DDE0007F6964 /* InterfaceBuilderViewController.swift in Sources */,
|
EE0954AF1B97DDE0007F6964 /* InterfaceBuilderViewController.swift in Sources */,
|
||||||
|
|
@ -498,11 +501,11 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
DEVELOPMENT_TEAM = HZF422TY46;
|
DEVELOPMENT_TEAM = SW5SL8G723;
|
||||||
INFOPLIST_FILE = "$(SRCROOT)/FSCalendarSwiftExample/Info.plist";
|
INFOPLIST_FILE = "$(SRCROOT)/FSCalendarSwiftExample/Info.plist";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSCalendarSwiftExample;
|
PRODUCT_BUNDLE_IDENTIFIER = com.dipendra.FSCalendarSwiftExample;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "FSCalendarSwiftExample/Objc-Bridge-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "FSCalendarSwiftExample/Objc-Bridge-Header.h";
|
||||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||||
|
|
@ -515,11 +518,11 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
DEVELOPMENT_TEAM = HZF422TY46;
|
DEVELOPMENT_TEAM = SW5SL8G723;
|
||||||
INFOPLIST_FILE = "$(SRCROOT)/FSCalendarSwiftExample/Info.plist";
|
INFOPLIST_FILE = "$(SRCROOT)/FSCalendarSwiftExample/Info.plist";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSCalendarSwiftExample;
|
PRODUCT_BUNDLE_IDENTIFIER = com.dipendra.FSCalendarSwiftExample;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "FSCalendarSwiftExample/Objc-Bridge-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "FSCalendarSwiftExample/Objc-Bridge-Header.h";
|
||||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||||
|
|
|
||||||
|
|
@ -278,28 +278,81 @@
|
||||||
</subviews>
|
</subviews>
|
||||||
</tableViewCellContentView>
|
</tableViewCellContentView>
|
||||||
</tableViewCell>
|
</tableViewCell>
|
||||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" reuseIdentifier="cell" textLabel="fGJ-HR-nLa" imageView="aHn-NP-iqx" style="IBUITableViewCellStyleDefault" id="mEc-Yq-s56">
|
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="cell_weeks_number" id="BOn-2g-TEq" customClass="FSWeeksSelectionCell" customModule="FSCalendarSwiftExample" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="143.5" width="375" height="44"/>
|
<rect key="frame" x="0.0" y="143.5" width="375" height="44"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="mEc-Yq-s56" id="Sz2-Op-ikR">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" tableViewCell="BOn-2g-TEq" id="g8C-Vq-AUS">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
|
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Lorem ipsum dolor sit er elit lamet" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="fGJ-HR-nLa">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Week(s)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SzV-hA-k6t">
|
||||||
<rect key="frame" x="48" y="0.0" width="312" height="43.5"/>
|
<rect key="frame" x="15" y="10.5" width="70" height="21"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<constraints>
|
||||||
|
<constraint firstAttribute="width" constant="70" id="JQ1-Ua-2wz"/>
|
||||||
|
<constraint firstAttribute="height" constant="21" id="gWe-yI-EzF"/>
|
||||||
|
</constraints>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="icon_cat" id="aHn-NP-iqx">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JKb-qi-PzU">
|
||||||
<rect key="frame" x="15" y="14" width="18" height="15"/>
|
<rect key="frame" x="330" y="7.5" width="30" height="30"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<constraints>
|
||||||
</imageView>
|
<constraint firstAttribute="width" constant="30" id="Xi8-H6-zGT"/>
|
||||||
|
<constraint firstAttribute="height" constant="30" id="mtu-hy-nX4"/>
|
||||||
|
</constraints>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="21"/>
|
||||||
|
<state key="normal" title="+">
|
||||||
|
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
|
</state>
|
||||||
|
<connections>
|
||||||
|
<action selector="increaseButtonPressedWithSender:" destination="BOn-2g-TEq" eventType="touchUpInside" id="gZH-NH-KQJ"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="99" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iZF-jG-qtn">
|
||||||
|
<rect key="frame" x="301" y="11.5" width="21" height="21"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="width" constant="21" id="U0i-mw-uLj"/>
|
||||||
|
<constraint firstAttribute="height" constant="21" id="aqK-F7-IL5"/>
|
||||||
|
</constraints>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
|
<nil key="textColor"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WJp-M4-Z65">
|
||||||
|
<rect key="frame" x="263" y="7.5" width="30" height="30"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="width" constant="30" id="62m-8w-vlE"/>
|
||||||
|
<constraint firstAttribute="height" constant="30" id="Usj-yo-VEX"/>
|
||||||
|
</constraints>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="21"/>
|
||||||
|
<state key="normal" title="-">
|
||||||
|
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
|
</state>
|
||||||
|
<connections>
|
||||||
|
<action selector="decreaseButtonPressedWithSender:" destination="BOn-2g-TEq" eventType="touchUpInside" id="fq9-Kk-b75"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstItem="WJp-M4-Z65" firstAttribute="centerY" secondItem="g8C-Vq-AUS" secondAttribute="centerY" id="2TS-Pq-G91"/>
|
||||||
|
<constraint firstItem="SzV-hA-k6t" firstAttribute="leading" secondItem="g8C-Vq-AUS" secondAttribute="leading" constant="15" id="6BF-BJ-n8z"/>
|
||||||
|
<constraint firstItem="JKb-qi-PzU" firstAttribute="leading" secondItem="iZF-jG-qtn" secondAttribute="trailing" constant="8" id="IJA-3v-bix"/>
|
||||||
|
<constraint firstItem="iZF-jG-qtn" firstAttribute="centerY" secondItem="g8C-Vq-AUS" secondAttribute="centerY" id="QJz-20-xa3"/>
|
||||||
|
<constraint firstItem="JKb-qi-PzU" firstAttribute="centerY" secondItem="g8C-Vq-AUS" secondAttribute="centerY" id="nDZ-hd-57N"/>
|
||||||
|
<constraint firstItem="SzV-hA-k6t" firstAttribute="centerY" secondItem="g8C-Vq-AUS" secondAttribute="centerY" id="rnY-sl-Xfw"/>
|
||||||
|
<constraint firstAttribute="trailing" secondItem="JKb-qi-PzU" secondAttribute="trailing" constant="15" id="t4p-jD-j3p"/>
|
||||||
|
<constraint firstItem="iZF-jG-qtn" firstAttribute="leading" secondItem="WJp-M4-Z65" secondAttribute="trailing" constant="8" id="wE5-OG-EoD"/>
|
||||||
|
</constraints>
|
||||||
</tableViewCellContentView>
|
</tableViewCellContentView>
|
||||||
|
<connections>
|
||||||
|
<outlet property="decreaseButton" destination="WJp-M4-Z65" id="jF0-S8-kPw"/>
|
||||||
|
<outlet property="increaseButton" destination="JKb-qi-PzU" id="12U-sn-g7t"/>
|
||||||
|
<outlet property="weeksLabel" destination="iZF-jG-qtn" id="pjg-Yd-b6w"/>
|
||||||
|
</connections>
|
||||||
</tableViewCell>
|
</tableViewCell>
|
||||||
</prototypes>
|
</prototypes>
|
||||||
|
<sections/>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="dataSource" destination="E9E-eQ-Fo2" id="U76-Sy-x7x"/>
|
<outlet property="dataSource" destination="E9E-eQ-Fo2" id="U76-Sy-x7x"/>
|
||||||
<outlet property="delegate" destination="E9E-eQ-Fo2" id="NsD-lC-L5v"/>
|
<outlet property="delegate" destination="E9E-eQ-Fo2" id="NsD-lC-L5v"/>
|
||||||
|
|
@ -333,7 +386,7 @@
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="ref-0a-lFG" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="ref-0a-lFG" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="844" y="-225"/>
|
<point key="canvasLocation" x="844" y="-225.33733133433284"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Configuration-->
|
<!--Configuration-->
|
||||||
<scene sceneID="EaG-2r-dag">
|
<scene sceneID="EaG-2r-dag">
|
||||||
|
|
@ -496,7 +549,7 @@
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Click to select" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Soy-1d-VzB">
|
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Click to select" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Soy-1d-VzB">
|
||||||
<rect key="frame" x="15" y="0.0" width="345" height="43.5"/>
|
<rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
|
@ -649,7 +702,6 @@
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="icon_cat" width="18" height="15"/>
|
|
||||||
<image name="icon_setting" width="24" height="24"/>
|
<image name="icon_setting" width="24" height="24"/>
|
||||||
</resources>
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@ class FSCalendarScopeExampleViewController: UIViewController, UITableViewDataSou
|
||||||
|
|
||||||
@IBOutlet weak var calendarHeightConstraint: NSLayoutConstraint!
|
@IBOutlet weak var calendarHeightConstraint: NSLayoutConstraint!
|
||||||
|
|
||||||
|
fileprivate var gregorian: NSCalendar! = NSCalendar(calendarIdentifier: .gregorian)
|
||||||
|
fileprivate var scope: FSCalendarScope = .month
|
||||||
|
fileprivate var numberOfWeeks = 1
|
||||||
|
|
||||||
fileprivate lazy var dateFormatter: DateFormatter = {
|
fileprivate lazy var dateFormatter: DateFormatter = {
|
||||||
let formatter = DateFormatter()
|
let formatter = DateFormatter()
|
||||||
formatter.dateFormat = "yyyy/MM/dd"
|
formatter.dateFormat = "yyyy/MM/dd"
|
||||||
|
|
@ -41,7 +45,8 @@ class FSCalendarScopeExampleViewController: UIViewController, UITableViewDataSou
|
||||||
|
|
||||||
self.view.addGestureRecognizer(self.scopeGesture)
|
self.view.addGestureRecognizer(self.scopeGesture)
|
||||||
self.tableView.panGestureRecognizer.require(toFail: self.scopeGesture)
|
self.tableView.panGestureRecognizer.require(toFail: self.scopeGesture)
|
||||||
self.calendar.scope = .week
|
self.calendar.placeholderType = .fillHeadTail
|
||||||
|
self.calendar.appearance.headerMinimumDissolvedAlpha = 0
|
||||||
|
|
||||||
// For UITest
|
// For UITest
|
||||||
self.calendar.accessibilityIdentifier = "calendar"
|
self.calendar.accessibilityIdentifier = "calendar"
|
||||||
|
|
@ -74,37 +79,50 @@ class FSCalendarScopeExampleViewController: UIViewController, UITableViewDataSou
|
||||||
}
|
}
|
||||||
|
|
||||||
func calendar(_ calendar: FSCalendar, didSelect date: Date, at monthPosition: FSCalendarMonthPosition) {
|
func calendar(_ calendar: FSCalendar, didSelect date: Date, at monthPosition: FSCalendarMonthPosition) {
|
||||||
print("did select date \(self.dateFormatter.string(from: date))")
|
|
||||||
let selectedDates = calendar.selectedDates.map({self.dateFormatter.string(from: $0)})
|
|
||||||
print("selected dates is \(selectedDates)")
|
|
||||||
if monthPosition == .next || monthPosition == .previous {
|
if monthPosition == .next || monthPosition == .previous {
|
||||||
calendar.setCurrentPage(date, animated: true)
|
calendar.setCurrentPage(date, animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Reload calendar header view
|
||||||
|
calendar.calendarHeaderView.reloadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
func calendarCurrentPageDidChange(_ calendar: FSCalendar) {
|
func maximumDate(for calendar: FSCalendar) -> Date {
|
||||||
print("\(self.dateFormatter.string(from: calendar.currentPage))")
|
return self.gregorian.date(byAdding: .weekOfYear, value: 104, to: Date(), options: NSCalendar.Options(rawValue: 0))!
|
||||||
|
}
|
||||||
|
|
||||||
|
func minimumDate(for calendar: FSCalendar) -> Date {
|
||||||
|
return self.gregorian.date(byAdding: .weekOfYear, value: -104, to: Date(), options: NSCalendar.Options(rawValue: 0))!
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- UITableViewDataSource
|
// MARK:- UITableViewDataSource
|
||||||
|
|
||||||
func numberOfSections(in tableView: UITableView) -> Int {
|
func numberOfSections(in tableView: UITableView) -> Int {
|
||||||
return 2
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||||
return [2,20][section]
|
if self.scope == .month {
|
||||||
|
return 2
|
||||||
|
} else {
|
||||||
|
return 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||||
if indexPath.section == 0 {
|
let identifier = ["cell_month", "cell_week", "cell_weeks_number"][indexPath.row]
|
||||||
let identifier = ["cell_month", "cell_week"][indexPath.row]
|
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: identifier)!
|
if indexPath.row == 2 {
|
||||||
return cell
|
guard let cell = tableView.dequeueReusableCell(withIdentifier: identifier) as? FSWeeksSelectionCell else {
|
||||||
} else {
|
return UITableViewCell()
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: "cell")!
|
}
|
||||||
|
|
||||||
|
cell.weeksLabel.text = "\(self.numberOfWeeks)"
|
||||||
|
cell.delegate = self
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let cell = tableView.dequeueReusableCell(withIdentifier: identifier)!
|
||||||
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -113,8 +131,25 @@ class FSCalendarScopeExampleViewController: UIViewController, UITableViewDataSou
|
||||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||||
tableView.deselectRow(at: indexPath, animated: true)
|
tableView.deselectRow(at: indexPath, animated: true)
|
||||||
if indexPath.section == 0 {
|
if indexPath.section == 0 {
|
||||||
let scope: FSCalendarScope = (indexPath.row == 0) ? .month : .week
|
if indexPath.row == 0 && self.scope != .month {
|
||||||
self.calendar.setScope(scope, animated: self.animationSwitch.isOn)
|
self.scope = .month
|
||||||
|
self.calendar.setScope(self.scope, animated: self.animationSwitch.isOn)
|
||||||
|
|
||||||
|
//
|
||||||
|
tableView.beginUpdates()
|
||||||
|
tableView.deleteRows(at: [IndexPath(row: 2, section: 0) ], with: .automatic)
|
||||||
|
tableView.endUpdates()
|
||||||
|
|
||||||
|
} else if indexPath.row == 1 && self.scope != .week {
|
||||||
|
self.calendar.numberOfWeeks = self.numberOfWeeks
|
||||||
|
self.scope = .week
|
||||||
|
self.calendar.setScope(self.scope, animated: self.animationSwitch.isOn)
|
||||||
|
|
||||||
|
//
|
||||||
|
tableView.beginUpdates()
|
||||||
|
tableView.insertRows(at: [IndexPath(row: 2, section: 0) ], with: .automatic)
|
||||||
|
tableView.endUpdates()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,13 +158,56 @@ class FSCalendarScopeExampleViewController: UIViewController, UITableViewDataSou
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- Target actions
|
// MARK:- Target actions
|
||||||
|
|
||||||
@IBAction func toggleClicked(sender: AnyObject) {
|
@IBAction func toggleClicked(sender: AnyObject) {
|
||||||
if self.calendar.scope == .month {
|
if self.scope == .month {
|
||||||
self.calendar.setScope(.week, animated: self.animationSwitch.isOn)
|
self.calendar.numberOfWeeks = self.numberOfWeeks
|
||||||
|
self.scope = .week
|
||||||
|
self.calendar.setScope(self.scope, animated: self.animationSwitch.isOn)
|
||||||
|
|
||||||
|
//
|
||||||
|
tableView.beginUpdates()
|
||||||
|
tableView.insertRows(at: [IndexPath(row: 2, section: 0) ], with: .automatic)
|
||||||
|
tableView.endUpdates()
|
||||||
} else {
|
} else {
|
||||||
self.calendar.setScope(.month, animated: self.animationSwitch.isOn)
|
self.scope = .month
|
||||||
|
self.calendar.setScope(self.scope, animated: self.animationSwitch.isOn)
|
||||||
|
|
||||||
|
//
|
||||||
|
tableView.beginUpdates()
|
||||||
|
tableView.deleteRows(at: [IndexPath(row: 2, section: 0) ], with: .automatic)
|
||||||
|
tableView.endUpdates()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension FSCalendarScopeExampleViewController: FSWeeksSelectionCellDelegate {
|
||||||
|
func increaseButtonPressed(cell: FSWeeksSelectionCell) {
|
||||||
|
if self.numberOfWeeks < 4 {
|
||||||
|
self.numberOfWeeks += 1
|
||||||
|
cell.weeksLabel.text = "\(self.numberOfWeeks)"
|
||||||
|
if self.numberOfWeeks == 1 {
|
||||||
|
cell.decreaseButton.isEnabled = false
|
||||||
|
} else {
|
||||||
|
cell.decreaseButton.isEnabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
self.calendar.setNumberOfWeeks(self.numberOfWeeks, animated: self.animationSwitch.isOn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func decreaseButtonPressed(cell: FSWeeksSelectionCell) {
|
||||||
|
if self.numberOfWeeks > 1 {
|
||||||
|
self.numberOfWeeks -= 1
|
||||||
|
cell.weeksLabel.text = "\(self.numberOfWeeks)"
|
||||||
|
if self.numberOfWeeks == 1 {
|
||||||
|
cell.decreaseButton.isEnabled = false
|
||||||
|
} else {
|
||||||
|
cell.decreaseButton.isEnabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
self.calendar.setNumberOfWeeks(self.numberOfWeeks, animated: self.animationSwitch.isOn)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
//
|
||||||
|
// FSWeeksSelectionCell.swift
|
||||||
|
// FSCalendarSwiftExample
|
||||||
|
//
|
||||||
|
// Created by Dipendra Khatri on 8/28/18.
|
||||||
|
// Copyright © 2018 wenchao. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
protocol FSWeeksSelectionCellDelegate: class {
|
||||||
|
func increaseButtonPressed(cell: FSWeeksSelectionCell)
|
||||||
|
func decreaseButtonPressed(cell: FSWeeksSelectionCell)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class FSWeeksSelectionCell: UITableViewCell {
|
||||||
|
|
||||||
|
@IBOutlet weak var increaseButton: UIButton!
|
||||||
|
@IBOutlet weak var decreaseButton: UIButton!
|
||||||
|
@IBOutlet weak var weeksLabel: UILabel!
|
||||||
|
|
||||||
|
weak var delegate: FSWeeksSelectionCellDelegate?
|
||||||
|
|
||||||
|
override func awakeFromNib() {
|
||||||
|
super.awakeFromNib()
|
||||||
|
// Initialization code
|
||||||
|
}
|
||||||
|
|
||||||
|
override func setSelected(_ selected: Bool, animated: Bool) {
|
||||||
|
super.setSelected(selected, animated: animated)
|
||||||
|
|
||||||
|
// Configure the view for the selected state
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK:- Target actions
|
||||||
|
@IBAction func increaseButtonPressed(sender: AnyObject) {
|
||||||
|
delegate?.increaseButtonPressed(cell: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func decreaseButtonPressed(sender: AnyObject) {
|
||||||
|
delegate?.decreaseButtonPressed(cell: self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
|
|
||||||
s.name = "FSCalendar"
|
s.name = "FSCalendar"
|
||||||
s.version = "2.8.4"
|
s.version = "2.8.0"
|
||||||
s.summary = "A superiorly awesome iOS7+ calendar control, compatible with Objective-C and Swift."
|
s.summary = "A superiorly awesome iOS7+ calendar control, compatible with Objective-C and Swift."
|
||||||
|
|
||||||
s.homepage = "https://github.com/WenchaoD/FSCalendar"
|
s.homepage = "https://github.com/WenchaoD/FSCalendar"
|
||||||
s.screenshots = "https://cloud.githubusercontent.com/assets/5186464/10262249/4fabae40-69f2-11e5-97ab-afbacd0a3da2.jpg"
|
s.screenshots = "https://cloud.githubusercontent.com/assets/5186464/10262249/4fabae40-69f2-11e5-97ab-afbacd0a3da2.jpg"
|
||||||
s.license = 'MIT'
|
s.license = 'MIT'
|
||||||
s.author = { "Wenchao Ding" => "f33chobits@gmail.com" }
|
s.author = { "Wenchao Ding" => "f33chobits@gmail.com" }
|
||||||
s.source = { :git => "https://github.com/TouchInstinct/FSCalendar.git", :tag => s.version.to_s }
|
s.source = { :git => "https://github.com/WenchaoD/FSCalendar.git", :tag => s.version.to_s }
|
||||||
|
|
||||||
s.platform = :ios
|
s.platform = :ios
|
||||||
s.ios.deployment_target = '8.0'
|
s.ios.deployment_target = '8.0'
|
||||||
|
|
|
||||||
|
|
@ -402,16 +402,16 @@ IB_DESIGNABLE
|
||||||
*/
|
*/
|
||||||
@property (readonly, nonatomic) NSArray<NSDate *> *selectedDates;
|
@property (readonly, nonatomic) NSArray<NSDate *> *selectedDates;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The number of weeks to display when scope of the calendar is set to week.
|
||||||
|
*/
|
||||||
|
@property (assign, nonatomic) NSInteger numberOfWeeks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reload the dates and appearance of the calendar.
|
Reload the dates and appearance of the calendar.
|
||||||
*/
|
*/
|
||||||
- (void)reloadData;
|
- (void)reloadData;
|
||||||
|
|
||||||
/**
|
|
||||||
Reload data of the calendar cell.
|
|
||||||
*/
|
|
||||||
- (void)reloadDataForCell:(FSCalendarCell *)cell atIndexPath:(NSIndexPath *)indexPath;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Change the scope of the calendar. Make sure `-calendar:boundingRectWillChange:animated` is correctly adopted.
|
Change the scope of the calendar. Make sure `-calendar:boundingRectWillChange:animated` is correctly adopted.
|
||||||
|
|
||||||
|
|
@ -420,6 +420,14 @@ Reload data of the calendar cell.
|
||||||
*/
|
*/
|
||||||
- (void)setScope:(FSCalendarScope)scope animated:(BOOL)animated;
|
- (void)setScope:(FSCalendarScope)scope animated:(BOOL)animated;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Change the number of weeks of the calendar while scope is FSCalendarScopeWeek. Make sure `-calendar:boundingRectWillChange:animated` is correctly adopted.
|
||||||
|
|
||||||
|
@param numberOfWeeks The target number of weeks to change.
|
||||||
|
@param animated YES if you want to animate the change; NO if the change should be immediate.
|
||||||
|
*/
|
||||||
|
- (void)setNumberOfWeeks:(NSInteger)numberOfWeeks animated:(BOOL)animated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Selects a given date in the calendar.
|
Selects a given date in the calendar.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,8 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
- (void)selectCounterpartDate:(NSDate *)date;
|
- (void)selectCounterpartDate:(NSDate *)date;
|
||||||
- (void)deselectCounterpartDate:(NSDate *)date;
|
- (void)deselectCounterpartDate:(NSDate *)date;
|
||||||
|
|
||||||
|
- (void)reloadDataForCell:(FSCalendarCell *)cell atIndexPath:(NSIndexPath *)indexPath;
|
||||||
|
|
||||||
- (void)adjustMonthPosition;
|
- (void)adjustMonthPosition;
|
||||||
- (BOOL)requestBoundingDatesIfNecessary;
|
- (BOOL)requestBoundingDatesIfNecessary;
|
||||||
- (void)executePendingOperationsIfNeeded;
|
- (void)executePendingOperationsIfNeeded;
|
||||||
|
|
@ -151,11 +153,11 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
_formatter = [[NSDateFormatter alloc] init];
|
_formatter = [[NSDateFormatter alloc] init];
|
||||||
_formatter.dateFormat = @"yyyy-MM-dd";
|
_formatter.dateFormat = @"yyyy-MM-dd";
|
||||||
_locale = [NSLocale currentLocale];
|
_locale = [NSLocale currentLocale];
|
||||||
_timeZone = [NSTimeZone defaultTimeZone];
|
_timeZone = [NSTimeZone localTimeZone];
|
||||||
_firstWeekday = 1;
|
_firstWeekday = 1;
|
||||||
[self invalidateDateTools];
|
[self invalidateDateTools];
|
||||||
|
|
||||||
_today = [self.gregorian startOfDayForDate:[NSDate date]];
|
_today = [self.gregorian dateBySettingHour:0 minute:0 second:0 ofDate:[NSDate date] options:0];
|
||||||
_currentPage = [self.gregorian fs_firstDayOfMonth:_today];
|
_currentPage = [self.gregorian fs_firstDayOfMonth:_today];
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -182,6 +184,8 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
_orientation = self.currentCalendarOrientation;
|
_orientation = self.currentCalendarOrientation;
|
||||||
_placeholderType = FSCalendarPlaceholderTypeFillSixRows;
|
_placeholderType = FSCalendarPlaceholderTypeFillSixRows;
|
||||||
|
|
||||||
|
_numberOfWeeks = 1;
|
||||||
|
|
||||||
_dataSourceProxy = [FSCalendarDelegationFactory dataSourceProxy];
|
_dataSourceProxy = [FSCalendarDelegationFactory dataSourceProxy];
|
||||||
_delegateProxy = [FSCalendarDelegationFactory delegateProxy];
|
_delegateProxy = [FSCalendarDelegationFactory delegateProxy];
|
||||||
|
|
||||||
|
|
@ -312,7 +316,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FSCalendarScopeWeek: {
|
case FSCalendarScopeWeek: {
|
||||||
CGFloat contentHeight = rowHeight + padding*2;
|
CGFloat contentHeight = rowHeight*self.numberOfWeeks + padding*2;
|
||||||
_daysContainer.frame = CGRectMake(0, headerHeight+weekdayHeight, self.fs_width, contentHeight);
|
_daysContainer.frame = CGRectMake(0, headerHeight+weekdayHeight, self.fs_width, contentHeight);
|
||||||
_collectionView.frame = CGRectMake(0, 0, _daysContainer.fs_width, contentHeight);
|
_collectionView.frame = CGRectMake(0, 0, _daysContainer.fs_width, contentHeight);
|
||||||
break;
|
break;
|
||||||
|
|
@ -360,7 +364,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
return CGSizeMake(size.width, height);
|
return CGSizeMake(size.width, height);
|
||||||
}
|
}
|
||||||
case FSCalendarScopeWeek: {
|
case FSCalendarScopeWeek: {
|
||||||
CGFloat height = weekdayHeight + headerHeight + rowHeight + paddings;
|
CGFloat height = weekdayHeight + headerHeight + rowHeight*self.numberOfWeeks + paddings;
|
||||||
return CGSizeMake(size.width, height);
|
return CGSizeMake(size.width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -389,7 +393,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
return 42;
|
return 42;
|
||||||
}
|
}
|
||||||
case FSCalendarScopeWeek: {
|
case FSCalendarScopeWeek: {
|
||||||
return 7;
|
return self.numberOfWeeks*7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 7;
|
return 7;
|
||||||
|
|
@ -611,7 +615,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
}
|
}
|
||||||
case FSCalendarScopeWeek: {
|
case FSCalendarScopeWeek: {
|
||||||
NSDate *minimumPage = [self.gregorian fs_firstDayOfWeek:_minimumDate];
|
NSDate *minimumPage = [self.gregorian fs_firstDayOfWeek:_minimumDate];
|
||||||
targetPage = [self.gregorian dateByAddingUnit:NSCalendarUnitWeekOfYear value:sections toDate:minimumPage options:0];
|
targetPage = [self.gregorian dateByAddingUnit:NSCalendarUnitWeekOfYear value:(sections*self.numberOfWeeks) toDate:minimumPage options:0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -676,6 +680,11 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setNumberOfWeeks:(NSInteger)numberOfWeeks
|
||||||
|
{
|
||||||
|
[self setNumberOfWeeks:numberOfWeeks animated:NO];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setScope:(FSCalendarScope)scope
|
- (void)setScope:(FSCalendarScope)scope
|
||||||
{
|
{
|
||||||
[self setScope:scope animated:NO];
|
[self setScope:scope animated:NO];
|
||||||
|
|
@ -699,7 +708,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
_today = nil;
|
_today = nil;
|
||||||
} else {
|
} else {
|
||||||
FSCalendarAssertDateInBounds(today,self.gregorian,self.minimumDate,self.maximumDate);
|
FSCalendarAssertDateInBounds(today,self.gregorian,self.minimumDate,self.maximumDate);
|
||||||
_today = [self.gregorian startOfDayForDate:today];
|
_today = [self.gregorian dateBySettingHour:0 minute:0 second:0 ofDate:today options:0];
|
||||||
}
|
}
|
||||||
if (self.hasValidateVisibleLayout) {
|
if (self.hasValidateVisibleLayout) {
|
||||||
[self.visibleCells makeObjectsPerformSelector:@selector(setDateIsToday:) withObject:nil];
|
[self.visibleCells makeObjectsPerformSelector:@selector(setDateIsToday:) withObject:nil];
|
||||||
|
|
@ -717,7 +726,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
{
|
{
|
||||||
[self requestBoundingDatesIfNecessary];
|
[self requestBoundingDatesIfNecessary];
|
||||||
if (self.floatingMode || [self isDateInDifferentPage:currentPage]) {
|
if (self.floatingMode || [self isDateInDifferentPage:currentPage]) {
|
||||||
currentPage = [self.gregorian startOfDayForDate:currentPage];
|
currentPage = [self.gregorian dateBySettingHour:0 minute:0 second:0 ofDate:currentPage options:0];
|
||||||
if ([self isPageInRange:currentPage]) {
|
if ([self isPageInRange:currentPage]) {
|
||||||
[self scrollToPageForDate:currentPage animated:animated];
|
[self scrollToPageForDate:currentPage animated:animated];
|
||||||
}
|
}
|
||||||
|
|
@ -997,6 +1006,16 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
[self.collectionView reloadData];
|
[self.collectionView reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setNumberOfWeeks:(NSInteger)numberOfWeeks animated:(BOOL)animated
|
||||||
|
{
|
||||||
|
_numberOfWeeks = numberOfWeeks;
|
||||||
|
|
||||||
|
if (_scope == FSCalendarScopeWeek) {
|
||||||
|
if (self.transitionCoordinator.state != FSCalendarTransitionStateIdle) return;
|
||||||
|
[self.transitionCoordinator performBoundingRectTransitionForScope:self.scope animated:animated];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setScope:(FSCalendarScope)scope animated:(BOOL)animated
|
- (void)setScope:(FSCalendarScope)scope animated:(BOOL)animated
|
||||||
{
|
{
|
||||||
if (self.floatingMode) return;
|
if (self.floatingMode) return;
|
||||||
|
|
@ -1035,7 +1054,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
|
|
||||||
- (void)deselectDate:(NSDate *)date
|
- (void)deselectDate:(NSDate *)date
|
||||||
{
|
{
|
||||||
date = [self.gregorian startOfDayForDate:date];
|
date = [self.gregorian dateBySettingHour:0 minute:0 second:0 ofDate:date options:0];
|
||||||
if (![_selectedDates containsObject:date]) {
|
if (![_selectedDates containsObject:date]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1058,7 +1077,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
|
|
||||||
FSCalendarAssertDateInBounds(date,self.gregorian,self.minimumDate,self.maximumDate);
|
FSCalendarAssertDateInBounds(date,self.gregorian,self.minimumDate,self.maximumDate);
|
||||||
|
|
||||||
NSDate *targetDate = [self.gregorian startOfDayForDate:date];
|
NSDate *targetDate = [self.gregorian dateBySettingHour:0 minute:0 second:0 ofDate:date options:0];
|
||||||
NSIndexPath *targetIndexPath = [self.calculator indexPathForDate:targetDate];
|
NSIndexPath *targetIndexPath = [self.calculator indexPathForDate:targetDate];
|
||||||
|
|
||||||
BOOL shouldSelect = YES;
|
BOOL shouldSelect = YES;
|
||||||
|
|
@ -1249,7 +1268,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
case FSCalendarScopeMonth:
|
case FSCalendarScopeMonth:
|
||||||
return ![self.gregorian isDate:date equalToDate:_currentPage toUnitGranularity:NSCalendarUnitMonth];
|
return ![self.gregorian isDate:date equalToDate:_currentPage toUnitGranularity:NSCalendarUnitMonth];
|
||||||
case FSCalendarScopeWeek:
|
case FSCalendarScopeWeek:
|
||||||
return ![self.gregorian isDate:date equalToDate:_currentPage toUnitGranularity:NSCalendarUnitWeekOfYear];
|
return ![date isInRange:_currentPage endDate:[self.gregorian fs_lastDayOfWeek:[self.gregorian fs_dayByAddingWeeks:(_numberOfWeeks - 1) toDate:_currentPage]]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1532,9 +1551,9 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
|
||||||
_needsRequestingBoundingDates = NO;
|
_needsRequestingBoundingDates = NO;
|
||||||
self.formatter.dateFormat = @"yyyy-MM-dd";
|
self.formatter.dateFormat = @"yyyy-MM-dd";
|
||||||
NSDate *newMin = [self.dataSourceProxy minimumDateForCalendar:self]?:[self.formatter dateFromString:@"1970-01-01"];
|
NSDate *newMin = [self.dataSourceProxy minimumDateForCalendar:self]?:[self.formatter dateFromString:@"1970-01-01"];
|
||||||
newMin = [self.gregorian startOfDayForDate:newMin];
|
newMin = [self.gregorian dateBySettingHour:0 minute:0 second:0 ofDate:newMin options:0];
|
||||||
NSDate *newMax = [self.dataSourceProxy maximumDateForCalendar:self]?:[self.formatter dateFromString:@"2099-12-31"];
|
NSDate *newMax = [self.dataSourceProxy maximumDateForCalendar:self]?:[self.formatter dateFromString:@"2099-12-31"];
|
||||||
newMax = [self.gregorian startOfDayForDate:newMax];
|
newMax = [self.gregorian dateBySettingHour:0 minute:0 second:0 ofDate:newMax options:0];
|
||||||
|
|
||||||
NSAssert([self.gregorian compareDate:newMin toDate:newMax toUnitGranularity:NSCalendarUnitDay] != NSOrderedDescending, @"The minimum date of calendar should be earlier than the maximum.");
|
NSAssert([self.gregorian compareDate:newMin toDate:newMax toUnitGranularity:NSCalendarUnitDay] != NSOrderedDescending, @"The minimum date of calendar should be earlier than the maximum.");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarSeparators) {
|
||||||
|
|
||||||
typedef NS_OPTIONS(NSUInteger, FSCalendarCaseOptions) {
|
typedef NS_OPTIONS(NSUInteger, FSCalendarCaseOptions) {
|
||||||
FSCalendarCaseOptionsHeaderUsesDefaultCase = 0,
|
FSCalendarCaseOptionsHeaderUsesDefaultCase = 0,
|
||||||
FSCalendarCaseOptionsHeaderUsesUpperCase = 1 << 0,
|
FSCalendarCaseOptionsHeaderUsesUpperCase = 1,
|
||||||
FSCalendarCaseOptionsHeaderUsesCapitalized = 1 << 1,
|
|
||||||
|
|
||||||
FSCalendarCaseOptionsWeekdayUsesDefaultCase = 0 << 4,
|
FSCalendarCaseOptionsWeekdayUsesDefaultCase = 0 << 4,
|
||||||
FSCalendarCaseOptionsWeekdayUsesUpperCase = 1 << 4,
|
FSCalendarCaseOptionsWeekdayUsesUpperCase = 1 << 4,
|
||||||
|
|
@ -64,11 +63,6 @@ typedef NS_OPTIONS(NSUInteger, FSCalendarCaseOptions) {
|
||||||
*/
|
*/
|
||||||
@property (strong, nonatomic) UIFont *headerTitleFont;
|
@property (strong, nonatomic) UIFont *headerTitleFont;
|
||||||
|
|
||||||
/**
|
|
||||||
* The offset of the month header from default position.
|
|
||||||
*/
|
|
||||||
@property (assign, nonatomic) CGPoint headerTitleOffset;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The offset of the day text from default position.
|
* The offset of the day text from default position.
|
||||||
*/
|
*/
|
||||||
|
|
@ -109,21 +103,11 @@ typedef NS_OPTIONS(NSUInteger, FSCalendarCaseOptions) {
|
||||||
*/
|
*/
|
||||||
@property (strong, nonatomic) UIColor *headerTitleColor;
|
@property (strong, nonatomic) UIColor *headerTitleColor;
|
||||||
|
|
||||||
/**
|
|
||||||
* The color oh month header separator
|
|
||||||
*/
|
|
||||||
@property (strong, nonatomic) UIColor *headerSeparatorColor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date format of the month header.
|
* The date format of the month header.
|
||||||
*/
|
*/
|
||||||
@property (strong, nonatomic) NSString *headerDateFormat;
|
@property (strong, nonatomic) NSString *headerDateFormat;
|
||||||
|
|
||||||
/**
|
|
||||||
* The text alignment of the month header.
|
|
||||||
*/
|
|
||||||
@property (assign, nonatomic) NSTextAlignment headerTitleAlignment;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The alpha value of month label staying on the fringes.
|
* The alpha value of month label staying on the fringes.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,8 @@
|
||||||
_headerTitleFont = [UIFont systemFontOfSize:FSCalendarStandardHeaderTextSize];
|
_headerTitleFont = [UIFont systemFontOfSize:FSCalendarStandardHeaderTextSize];
|
||||||
|
|
||||||
_headerTitleColor = FSCalendarStandardTitleTextColor;
|
_headerTitleColor = FSCalendarStandardTitleTextColor;
|
||||||
_headerSeparatorColor = FSCalendarStandardLineColor;
|
|
||||||
_headerDateFormat = @"MMMM yyyy";
|
_headerDateFormat = @"MMMM yyyy";
|
||||||
_headerMinimumDissolvedAlpha = 0.2;
|
_headerMinimumDissolvedAlpha = 0.2;
|
||||||
_headerTitleOffset = CGPointZero;
|
|
||||||
_headerTitleAlignment = NSTextAlignmentCenter;
|
|
||||||
_weekdayTextColor = FSCalendarStandardTitleTextColor;
|
_weekdayTextColor = FSCalendarStandardTitleTextColor;
|
||||||
_caseOptions = FSCalendarCaseOptionsHeaderUsesDefaultCase|FSCalendarCaseOptionsWeekdayUsesDefaultCase;
|
_caseOptions = FSCalendarCaseOptionsHeaderUsesDefaultCase|FSCalendarCaseOptionsWeekdayUsesDefaultCase;
|
||||||
|
|
||||||
|
|
@ -114,13 +111,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setHeaderTitleOffset:(CGPoint)headerTitleOffset {
|
|
||||||
if (!CGPointEqualToPoint(_headerTitleOffset, headerTitleOffset)) {
|
|
||||||
_headerTitleOffset = headerTitleOffset;
|
|
||||||
[self.calendar configureAppearance];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setTitleOffset:(CGPoint)titleOffset
|
- (void)setTitleOffset:(CGPoint)titleOffset
|
||||||
{
|
{
|
||||||
if (!CGPointEqualToPoint(_titleOffset, titleOffset)) {
|
if (!CGPointEqualToPoint(_titleOffset, titleOffset)) {
|
||||||
|
|
@ -412,14 +402,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setHeaderSeparatorColor:(UIColor *)headerSeparatorColor
|
|
||||||
{
|
|
||||||
if (![_headerSeparatorColor isEqual:headerSeparatorColor]) {
|
|
||||||
_headerSeparatorColor = headerSeparatorColor;
|
|
||||||
[self.calendar configureAppearance];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setHeaderMinimumDissolvedAlpha:(CGFloat)headerMinimumDissolvedAlpha
|
- (void)setHeaderMinimumDissolvedAlpha:(CGFloat)headerMinimumDissolvedAlpha
|
||||||
{
|
{
|
||||||
if (_headerMinimumDissolvedAlpha != headerMinimumDissolvedAlpha) {
|
if (_headerMinimumDissolvedAlpha != headerMinimumDissolvedAlpha) {
|
||||||
|
|
@ -436,14 +418,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setHeaderTitleAlignment:(NSTextAlignment)headerTitleAlignment
|
|
||||||
{
|
|
||||||
if (_headerTitleAlignment != headerTitleAlignment) {
|
|
||||||
_headerTitleAlignment = headerTitleAlignment;
|
|
||||||
[self.calendar configureAppearance];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setCaseOptions:(FSCalendarCaseOptions)caseOptions
|
- (void)setCaseOptions:(FSCalendarCaseOptions)caseOptions
|
||||||
{
|
{
|
||||||
if (_caseOptions != caseOptions) {
|
if (_caseOptions != caseOptions) {
|
||||||
|
|
@ -508,22 +482,22 @@
|
||||||
|
|
||||||
- (void)setTitleTextSize:(CGFloat)titleTextSize
|
- (void)setTitleTextSize:(CGFloat)titleTextSize
|
||||||
{
|
{
|
||||||
self.titleFont = [self.titleFont fontWithSize:titleTextSize];
|
self.titleFont = [UIFont fontWithName:self.titleFont.fontName size:titleTextSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setSubtitleTextSize:(CGFloat)subtitleTextSize
|
- (void)setSubtitleTextSize:(CGFloat)subtitleTextSize
|
||||||
{
|
{
|
||||||
self.subtitleFont = [self.subtitleFont fontWithSize:subtitleTextSize];
|
self.subtitleFont = [UIFont fontWithName:self.subtitleFont.fontName size:subtitleTextSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setWeekdayTextSize:(CGFloat)weekdayTextSize
|
- (void)setWeekdayTextSize:(CGFloat)weekdayTextSize
|
||||||
{
|
{
|
||||||
self.weekdayFont = [self.weekdayFont fontWithSize:weekdayTextSize];
|
self.weekdayFont = [UIFont fontWithName:self.weekdayFont.fontName size:weekdayTextSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setHeaderTitleTextSize:(CGFloat)headerTitleTextSize
|
- (void)setHeaderTitleTextSize:(CGFloat)headerTitleTextSize
|
||||||
{
|
{
|
||||||
self.headerTitleFont = [self.headerTitleFont fontWithSize:headerTitleTextSize];
|
self.headerTitleFont = [UIFont fontWithName:self.headerTitleFont.fontName size:headerTitleTextSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)invalidateAppearance
|
- (void)invalidateAppearance
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,8 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FSCalendarScopeWeek: {
|
case FSCalendarScopeWeek: {
|
||||||
section = [self.gregorian components:NSCalendarUnitWeekOfYear fromDate:[self.gregorian fs_firstDayOfWeek:self.minimumDate] toDate:[self.gregorian fs_firstDayOfWeek:date] options:0].weekOfYear;
|
NSInteger weekOfYear = [self.gregorian components:NSCalendarUnitWeekOfYear fromDate:[self.gregorian fs_firstDayOfWeek:self.minimumDate] toDate:[self.gregorian fs_firstDayOfWeek:date] options:0].weekOfYear;
|
||||||
|
section = weekOfYear/self.calendar.numberOfWeeks;
|
||||||
item = (([self.gregorian component:NSCalendarUnitWeekday fromDate:date] - self.gregorian.firstWeekday) + 7) % 7;
|
item = (([self.gregorian component:NSCalendarUnitWeekday fromDate:date] - self.gregorian.firstWeekday) + 7) % 7;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +191,7 @@
|
||||||
NSNumber *key = @(section);
|
NSNumber *key = @(section);
|
||||||
NSDate *week = self.weeks[key];
|
NSDate *week = self.weeks[key];
|
||||||
if (!week) {
|
if (!week) {
|
||||||
week = [self.gregorian dateByAddingUnit:NSCalendarUnitWeekOfYear value:section toDate:[self.gregorian fs_firstDayOfWeek:self.minimumDate] options:0];
|
week = [self.gregorian dateByAddingUnit:NSCalendarUnitWeekOfYear value:(section*self.calendar.numberOfWeeks) toDate:[self.gregorian fs_firstDayOfWeek:self.minimumDate] options:0];
|
||||||
self.weeks[key] = week;
|
self.weeks[key] = week;
|
||||||
}
|
}
|
||||||
return week;
|
return week;
|
||||||
|
|
@ -203,7 +204,7 @@
|
||||||
return self.numberOfMonths;
|
return self.numberOfMonths;
|
||||||
}
|
}
|
||||||
case FSCalendarScopeWeek: {
|
case FSCalendarScopeWeek: {
|
||||||
return self.numberOfWeeks;
|
return (self.numberOfWeeks/self.calendar.numberOfWeeks) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -221,7 +222,7 @@
|
||||||
if (self.calendar.placeholderType == FSCalendarPlaceholderTypeFillSixRows) return 6;
|
if (self.calendar.placeholderType == FSCalendarPlaceholderTypeFillSixRows) return 6;
|
||||||
|
|
||||||
NSNumber *rowCount = self.rowCounts[month];
|
NSNumber *rowCount = self.rowCounts[month];
|
||||||
if (rowCount == nil) {
|
if (!rowCount) {
|
||||||
NSDate *firstDayOfMonth = [self.gregorian fs_firstDayOfMonth:month];
|
NSDate *firstDayOfMonth = [self.gregorian fs_firstDayOfMonth:month];
|
||||||
NSInteger weekdayOfFirstDay = [self.gregorian component:NSCalendarUnitWeekday fromDate:firstDayOfMonth];
|
NSInteger weekdayOfFirstDay = [self.gregorian component:NSCalendarUnitWeekday fromDate:firstDayOfMonth];
|
||||||
NSInteger numberOfDaysInMonth = [self.gregorian fs_numberOfDaysInMonth:month];
|
NSInteger numberOfDaysInMonth = [self.gregorian fs_numberOfDaysInMonth:month];
|
||||||
|
|
@ -236,7 +237,7 @@
|
||||||
|
|
||||||
- (NSInteger)numberOfRowsInSection:(NSInteger)section
|
- (NSInteger)numberOfRowsInSection:(NSInteger)section
|
||||||
{
|
{
|
||||||
if (self.calendar.transitionCoordinator.representingScope == FSCalendarScopeWeek) return 1;
|
if (self.calendar.transitionCoordinator.representingScope == FSCalendarScopeWeek) return self.calendar.numberOfWeeks;
|
||||||
NSDate *month = [self monthForSection:section];
|
NSDate *month = [self monthForSection:section];
|
||||||
return [self numberOfRowsInMonth:month];
|
return [self numberOfRowsInMonth:month];
|
||||||
}
|
}
|
||||||
|
|
@ -271,7 +272,7 @@
|
||||||
- (void)reloadSections
|
- (void)reloadSections
|
||||||
{
|
{
|
||||||
self.numberOfMonths = [self.gregorian components:NSCalendarUnitMonth fromDate:[self.gregorian fs_firstDayOfMonth:self.minimumDate] toDate:self.maximumDate options:0].month+1;
|
self.numberOfMonths = [self.gregorian components:NSCalendarUnitMonth fromDate:[self.gregorian fs_firstDayOfMonth:self.minimumDate] toDate:self.maximumDate options:0].month+1;
|
||||||
self.numberOfWeeks = [self.gregorian components:NSCalendarUnitWeekOfYear fromDate:[self.gregorian fs_firstDayOfWeek:self.minimumDate] toDate:self.maximumDate options:0].weekOfYear+1;
|
self.numberOfWeeks = [self.gregorian components:NSCalendarUnitWeekOfYear fromDate:[self.gregorian fs_firstDayOfWeek:self.minimumDate] toDate:self.maximumDate options:0].weekOfYear;
|
||||||
[self clearCaches];
|
[self clearCaches];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@ OFFSET_PROPERTY(preferredEventOffset, PreferredEventOffset, _appearance.eventOff
|
||||||
self.contentView = view;
|
self.contentView = view;
|
||||||
|
|
||||||
self.eventLayers = [NSPointerArray weakObjectsPointerArray];
|
self.eventLayers = [NSPointerArray weakObjectsPointerArray];
|
||||||
for (int i = 0; i < FSCalendarMaximumNumberOfEvents; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
CALayer *layer = [CALayer layer];
|
CALayer *layer = [CALayer layer];
|
||||||
layer.backgroundColor = [UIColor clearColor].CGColor;
|
layer.backgroundColor = [UIColor clearColor].CGColor;
|
||||||
[self.contentView.layer addSublayer:layer];
|
[self.contentView.layer addSublayer:layer];
|
||||||
|
|
@ -450,7 +450,7 @@ OFFSET_PROPERTY(preferredEventOffset, PreferredEventOffset, _appearance.eventOff
|
||||||
- (void)setNumberOfEvents:(NSInteger)numberOfEvents
|
- (void)setNumberOfEvents:(NSInteger)numberOfEvents
|
||||||
{
|
{
|
||||||
if (_numberOfEvents != numberOfEvents) {
|
if (_numberOfEvents != numberOfEvents) {
|
||||||
_numberOfEvents = MIN(MAX(numberOfEvents,0),FSCalendarMaximumNumberOfEvents);
|
_numberOfEvents = MIN(MAX(numberOfEvents,0),3);
|
||||||
[self setNeedsLayout];
|
[self setNeedsLayout];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FSCalendarScopeWeek: {
|
case FSCalendarScopeWeek: {
|
||||||
height = (self.collectionView.fs_height-self.sectionInsets.top-self.sectionInsets.bottom);
|
height = (self.collectionView.fs_height-self.sectionInsets.top-self.sectionInsets.bottom)/self.calendar.numberOfWeeks;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -167,7 +167,7 @@
|
||||||
// Calculate item heights and tops
|
// Calculate item heights and tops
|
||||||
free(self.heights);
|
free(self.heights);
|
||||||
self.heights = ({
|
self.heights = ({
|
||||||
NSInteger rowCount = self.calendar.transitionCoordinator.representingScope == FSCalendarScopeWeek ? 1 : 6;
|
NSInteger rowCount = self.calendar.transitionCoordinator.representingScope == FSCalendarScopeWeek ? self.calendar.numberOfWeeks : 6;
|
||||||
size_t rowSize = sizeof(CGFloat)*rowCount;
|
size_t rowSize = sizeof(CGFloat)*rowCount;
|
||||||
CGFloat *heights = malloc(rowSize);
|
CGFloat *heights = malloc(rowSize);
|
||||||
if (!self.calendar.floatingMode) {
|
if (!self.calendar.floatingMode) {
|
||||||
|
|
@ -183,7 +183,7 @@
|
||||||
|
|
||||||
free(self.tops);
|
free(self.tops);
|
||||||
self.tops = ({
|
self.tops = ({
|
||||||
NSInteger rowCount = self.calendar.transitionCoordinator.representingScope == FSCalendarScopeWeek ? 1 : 6;
|
NSInteger rowCount = self.calendar.transitionCoordinator.representingScope == FSCalendarScopeWeek ? self.calendar.numberOfWeeks : 6;
|
||||||
size_t rowSize = sizeof(CGFloat)*rowCount;
|
size_t rowSize = sizeof(CGFloat)*rowCount;
|
||||||
CGFloat *tops = malloc(rowSize);
|
CGFloat *tops = malloc(rowSize);
|
||||||
tops[0] = self.sectionInsets.top;
|
tops[0] = self.sectionInsets.top;
|
||||||
|
|
@ -292,7 +292,7 @@
|
||||||
endColumn;
|
endColumn;
|
||||||
});
|
});
|
||||||
|
|
||||||
NSInteger numberOfRows = self.calendar.transitionCoordinator.representingScope == FSCalendarScopeMonth ? 6 : 1;
|
NSInteger numberOfRows = self.calendar.transitionCoordinator.representingScope == FSCalendarScopeMonth ? 6 : self.calendar.numberOfWeeks;
|
||||||
|
|
||||||
for (NSInteger column = startColumn; column <= endColumn; column++) {
|
for (NSInteger column = startColumn; column <= endColumn; column++) {
|
||||||
for (NSInteger row = 0; row < numberOfRows; row++) {
|
for (NSInteger row = 0; row < numberOfRows; row++) {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ CG_EXTERN CGFloat const FSCalendarStandardHeaderTextSize;
|
||||||
CG_EXTERN CGFloat const FSCalendarMaximumEventDotDiameter;
|
CG_EXTERN CGFloat const FSCalendarMaximumEventDotDiameter;
|
||||||
|
|
||||||
UIKIT_EXTERN NSInteger const FSCalendarDefaultHourComponent;
|
UIKIT_EXTERN NSInteger const FSCalendarDefaultHourComponent;
|
||||||
UIKIT_EXTERN NSInteger const FSCalendarMaximumNumberOfEvents;
|
|
||||||
|
|
||||||
UIKIT_EXTERN NSString * const FSCalendarDefaultCellReuseIdentifier;
|
UIKIT_EXTERN NSString * const FSCalendarDefaultCellReuseIdentifier;
|
||||||
UIKIT_EXTERN NSString * const FSCalendarBlankCellReuseIdentifier;
|
UIKIT_EXTERN NSString * const FSCalendarBlankCellReuseIdentifier;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ CGFloat const FSCalendarStandardHeaderTextSize = 16.5;
|
||||||
CGFloat const FSCalendarMaximumEventDotDiameter = 4.8;
|
CGFloat const FSCalendarMaximumEventDotDiameter = 4.8;
|
||||||
|
|
||||||
NSInteger const FSCalendarDefaultHourComponent = 0;
|
NSInteger const FSCalendarDefaultHourComponent = 0;
|
||||||
NSInteger const FSCalendarMaximumNumberOfEvents = 3;
|
|
||||||
|
|
||||||
NSString * const FSCalendarDefaultCellReuseIdentifier = @"_FSCalendarDefaultCellReuseIdentifier";
|
NSString * const FSCalendarDefaultCellReuseIdentifier = @"_FSCalendarDefaultCellReuseIdentifier";
|
||||||
NSString * const FSCalendarBlankCellReuseIdentifier = @"_FSCalendarBlankCellReuseIdentifier";
|
NSString * const FSCalendarBlankCellReuseIdentifier = @"_FSCalendarBlankCellReuseIdentifier";
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
@property (readonly, nonatomic) NSArray *visibleStickyHeaders;
|
@property (readonly, nonatomic) NSArray *visibleStickyHeaders;
|
||||||
@property (readonly, nonatomic) CGFloat preferredHeaderHeight;
|
@property (readonly, nonatomic) CGFloat preferredHeaderHeight;
|
||||||
@property (readonly, nonatomic) CGFloat preferredWeekdayHeight;
|
@property (readonly, nonatomic) CGFloat preferredWeekdayHeight;
|
||||||
|
@property (readonly, nonatomic) UIView *bottomBorder;
|
||||||
|
|
||||||
@property (readonly, nonatomic) NSCalendar *gregorian;
|
@property (readonly, nonatomic) NSCalendar *gregorian;
|
||||||
@property (readonly, nonatomic) NSDateFormatter *formatter;
|
@property (readonly, nonatomic) NSDateFormatter *formatter;
|
||||||
|
|
@ -40,9 +41,13 @@
|
||||||
|
|
||||||
@property (assign, nonatomic) BOOL needsAdjustingViewFrame;
|
@property (assign, nonatomic) BOOL needsAdjustingViewFrame;
|
||||||
|
|
||||||
|
- (void)invalidateHeaders;
|
||||||
- (void)adjustMonthPosition;
|
- (void)adjustMonthPosition;
|
||||||
- (void)configureAppearance;
|
- (void)configureAppearance;
|
||||||
|
|
||||||
|
- (BOOL)isPageInRange:(NSDate *)page;
|
||||||
|
- (BOOL)isDateInRange:(NSDate *)date;
|
||||||
|
|
||||||
- (CGSize)sizeThatFits:(CGSize)size scope:(FSCalendarScope)scope;
|
- (CGSize)sizeThatFits:(CGSize)size scope:(FSCalendarScope)scope;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface NSDate (FSCalendarExtensions)
|
||||||
|
|
||||||
|
- (BOOL)isInRange:(NSDate *)startDate endDate:(NSDate *)endDate;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
@interface CALayer (FSCalendarExtensions)
|
@interface CALayer (FSCalendarExtensions)
|
||||||
|
|
||||||
|
|
@ -44,6 +50,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
- (nullable NSDate *)fs_firstDayOfWeek:(NSDate *)week;
|
- (nullable NSDate *)fs_firstDayOfWeek:(NSDate *)week;
|
||||||
- (nullable NSDate *)fs_lastDayOfWeek:(NSDate *)week;
|
- (nullable NSDate *)fs_lastDayOfWeek:(NSDate *)week;
|
||||||
- (nullable NSDate *)fs_middleDayOfWeek:(NSDate *)week;
|
- (nullable NSDate *)fs_middleDayOfWeek:(NSDate *)week;
|
||||||
|
- (nullable NSDate *)fs_dayByAddingWeeks:(NSInteger)weeks toDate:(NSDate *)date;
|
||||||
- (NSInteger)fs_numberOfDaysInMonth:(NSDate *)month;
|
- (NSInteger)fs_numberOfDaysInMonth:(NSDate *)month;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,20 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@implementation NSDate (FSCalendarExtensions)
|
||||||
|
|
||||||
|
- (BOOL)isInRange:(NSDate *)startDate endDate:(NSDate *)endDate
|
||||||
|
{
|
||||||
|
if ([self compare:startDate] == NSOrderedAscending)
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
if ([self compare:endDate] == NSOrderedDescending)
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation CALayer (FSCalendarExtensions)
|
@implementation CALayer (FSCalendarExtensions)
|
||||||
|
|
||||||
|
|
@ -171,7 +185,7 @@
|
||||||
components.day = - (weekdayComponents.weekday - self.firstWeekday);
|
components.day = - (weekdayComponents.weekday - self.firstWeekday);
|
||||||
components.day = (components.day-7) % 7;
|
components.day = (components.day-7) % 7;
|
||||||
NSDate *firstDayOfWeek = [self dateByAddingComponents:components toDate:week options:0];
|
NSDate *firstDayOfWeek = [self dateByAddingComponents:components toDate:week options:0];
|
||||||
firstDayOfWeek = [self startOfDayForDate:firstDayOfWeek];
|
firstDayOfWeek = [self dateBySettingHour:0 minute:0 second:0 ofDate:firstDayOfWeek options:0];
|
||||||
components.day = NSIntegerMax;
|
components.day = NSIntegerMax;
|
||||||
return firstDayOfWeek;
|
return firstDayOfWeek;
|
||||||
}
|
}
|
||||||
|
|
@ -184,7 +198,7 @@
|
||||||
components.day = - (weekdayComponents.weekday - self.firstWeekday);
|
components.day = - (weekdayComponents.weekday - self.firstWeekday);
|
||||||
components.day = (components.day-7) % 7 + 6;
|
components.day = (components.day-7) % 7 + 6;
|
||||||
NSDate *lastDayOfWeek = [self dateByAddingComponents:components toDate:week options:0];
|
NSDate *lastDayOfWeek = [self dateByAddingComponents:components toDate:week options:0];
|
||||||
lastDayOfWeek = [self startOfDayForDate:lastDayOfWeek];
|
lastDayOfWeek = [self dateBySettingHour:0 minute:0 second:0 ofDate:lastDayOfWeek options:0];
|
||||||
components.day = NSIntegerMax;
|
components.day = NSIntegerMax;
|
||||||
return lastDayOfWeek;
|
return lastDayOfWeek;
|
||||||
}
|
}
|
||||||
|
|
@ -195,11 +209,6 @@
|
||||||
NSDateComponents *weekdayComponents = [self components:NSCalendarUnitWeekday fromDate:week];
|
NSDateComponents *weekdayComponents = [self components:NSCalendarUnitWeekday fromDate:week];
|
||||||
NSDateComponents *componentsToSubtract = self.fs_privateComponents;
|
NSDateComponents *componentsToSubtract = self.fs_privateComponents;
|
||||||
componentsToSubtract.day = - (weekdayComponents.weekday - self.firstWeekday) + 3;
|
componentsToSubtract.day = - (weekdayComponents.weekday - self.firstWeekday) + 3;
|
||||||
// Fix https://github.com/WenchaoD/FSCalendar/issues/1100 and https://github.com/WenchaoD/FSCalendar/issues/1102
|
|
||||||
// If firstWeekday is not 1, and weekday is less than firstWeekday, the middleDayOfWeek will be the middle day of next week
|
|
||||||
if (weekdayComponents.weekday < self.firstWeekday) {
|
|
||||||
componentsToSubtract.day = componentsToSubtract.day - 7;
|
|
||||||
}
|
|
||||||
NSDate *middleDayOfWeek = [self dateByAddingComponents:componentsToSubtract toDate:week options:0];
|
NSDate *middleDayOfWeek = [self dateByAddingComponents:componentsToSubtract toDate:week options:0];
|
||||||
NSDateComponents *components = [self components:NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay|NSCalendarUnitHour fromDate:middleDayOfWeek];
|
NSDateComponents *components = [self components:NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay|NSCalendarUnitHour fromDate:middleDayOfWeek];
|
||||||
middleDayOfWeek = [self dateFromComponents:components];
|
middleDayOfWeek = [self dateFromComponents:components];
|
||||||
|
|
@ -216,6 +225,12 @@
|
||||||
return days.length;
|
return days.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (nullable NSDate *)fs_dayByAddingWeeks:(NSInteger)weeks toDate:(NSDate *)date
|
||||||
|
{
|
||||||
|
if (!date) return nil;
|
||||||
|
return [self dateByAddingUnit:NSCalendarUnitWeekOfYear value:weeks toDate:date options:0];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSDateComponents *)fs_privateComponents
|
- (NSDateComponents *)fs_privateComponents
|
||||||
{
|
{
|
||||||
NSDateComponents *components = objc_getAssociatedObject(self, _cmd);
|
NSDateComponents *components = objc_getAssociatedObject(self, _cmd);
|
||||||
|
|
|
||||||
|
|
@ -156,8 +156,8 @@
|
||||||
FSCalendarAppearance *appearance = self.calendar.appearance;
|
FSCalendarAppearance *appearance = self.calendar.appearance;
|
||||||
cell.titleLabel.font = appearance.headerTitleFont;
|
cell.titleLabel.font = appearance.headerTitleFont;
|
||||||
cell.titleLabel.textColor = appearance.headerTitleColor;
|
cell.titleLabel.textColor = appearance.headerTitleColor;
|
||||||
cell.titleLabel.textAlignment = appearance.headerTitleAlignment;
|
|
||||||
_calendar.formatter.dateFormat = appearance.headerDateFormat;
|
_calendar.formatter.dateFormat = appearance.headerDateFormat;
|
||||||
|
BOOL usesUpperCase = (appearance.caseOptions & 15) == FSCalendarCaseOptionsHeaderUsesUpperCase;
|
||||||
NSString *text = nil;
|
NSString *text = nil;
|
||||||
switch (self.calendar.transitionCoordinator.representingScope) {
|
switch (self.calendar.transitionCoordinator.representingScope) {
|
||||||
case FSCalendarScopeMonth: {
|
case FSCalendarScopeMonth: {
|
||||||
|
|
@ -179,9 +179,22 @@
|
||||||
if ((indexPath.item == 0 || indexPath.item == [self.collectionView numberOfItemsInSection:0] - 1)) {
|
if ((indexPath.item == 0 || indexPath.item == [self.collectionView numberOfItemsInSection:0] - 1)) {
|
||||||
text = nil;
|
text = nil;
|
||||||
} else {
|
} else {
|
||||||
NSDate *firstPage = [self.calendar.gregorian fs_middleDayOfWeek:self.calendar.minimumDate];
|
//Get first day of the first page
|
||||||
NSDate *date = [self.calendar.gregorian dateByAddingUnit:NSCalendarUnitWeekOfYear value:indexPath.item-1 toDate:firstPage options:0];
|
NSDate *firstPageHeadDate = [self.calendar.gregorian fs_firstDayOfWeek:self.calendar.minimumDate];
|
||||||
text = [_calendar.formatter stringFromDate:date];
|
|
||||||
|
//Get first day of the current page
|
||||||
|
NSDate *currentPageHeadDate = [self.calendar.gregorian dateByAddingUnit:NSCalendarUnitWeekOfYear
|
||||||
|
value:(indexPath.item-1) * self.calendar.numberOfWeeks
|
||||||
|
toDate:firstPageHeadDate
|
||||||
|
options:0];
|
||||||
|
|
||||||
|
//Get mid day of the current page
|
||||||
|
NSDate *currentPageMidDate = [self.calendar.gregorian dateByAddingUnit:NSCalendarUnitDay
|
||||||
|
value:((self.calendar.numberOfWeeks*7)/2)
|
||||||
|
toDate:currentPageHeadDate
|
||||||
|
options:0];
|
||||||
|
|
||||||
|
text = [_calendar.formatter stringFromDate:currentPageMidDate];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -189,13 +202,7 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BOOL usesUpperCase = (appearance.caseOptions & 15) == FSCalendarCaseOptionsHeaderUsesUpperCase;
|
text = usesUpperCase ? text.uppercaseString : text;
|
||||||
BOOL usesCapitalized = (appearance.caseOptions & 15) == FSCalendarCaseOptionsHeaderUsesCapitalized;
|
|
||||||
if (usesUpperCase) {
|
|
||||||
text = text.uppercaseString;
|
|
||||||
} else if (usesCapitalized) {
|
|
||||||
text = text.capitalizedString;
|
|
||||||
}
|
|
||||||
cell.titleLabel.text = text;
|
cell.titleLabel.text = text;
|
||||||
[cell setNeedsLayout];
|
[cell setNeedsLayout];
|
||||||
}
|
}
|
||||||
|
|
@ -217,6 +224,7 @@
|
||||||
self = [super initWithFrame:frame];
|
self = [super initWithFrame:frame];
|
||||||
if (self) {
|
if (self) {
|
||||||
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
|
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||||
|
titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
||||||
titleLabel.numberOfLines = 0;
|
titleLabel.numberOfLines = 0;
|
||||||
[self.contentView addSubview:titleLabel];
|
[self.contentView addSubview:titleLabel];
|
||||||
|
|
@ -234,11 +242,8 @@
|
||||||
- (void)layoutSubviews
|
- (void)layoutSubviews
|
||||||
{
|
{
|
||||||
[super layoutSubviews];
|
[super layoutSubviews];
|
||||||
|
|
||||||
CGPoint titleHeaderOffset = self.header.calendar.appearance.headerTitleOffset;
|
self.titleLabel.frame = self.contentView.bounds;
|
||||||
self.titleLabel.frame = CGRectOffset(self.contentView.bounds,
|
|
||||||
titleHeaderOffset.x,
|
|
||||||
titleHeaderOffset.y);
|
|
||||||
|
|
||||||
if (self.header.scrollDirection == UICollectionViewScrollDirectionHorizontal) {
|
if (self.header.scrollDirection == UICollectionViewScrollDirectionHorizontal) {
|
||||||
CGFloat position = [self.contentView convertPoint:CGPointMake(CGRectGetMidX(self.contentView.bounds), CGRectGetMidY(self.contentView.bounds)) toView:self.header].x;
|
CGFloat position = [self.contentView convertPoint:CGPointMake(CGRectGetMidX(self.contentView.bounds), CGRectGetMidY(self.contentView.bounds)) toView:self.header].x;
|
||||||
|
|
|
||||||
|
|
@ -69,12 +69,8 @@
|
||||||
CGFloat titleHeight = [@"1" sizeWithAttributes:@{NSFontAttributeName:self.calendar.appearance.headerTitleFont}].height*1.5 + weekdayMargin*3;
|
CGFloat titleHeight = [@"1" sizeWithAttributes:@{NSFontAttributeName:self.calendar.appearance.headerTitleFont}].height*1.5 + weekdayMargin*3;
|
||||||
|
|
||||||
_bottomBorder.frame = CGRectMake(0, _contentView.fs_height-weekdayHeight-weekdayMargin*2, _contentView.fs_width, 1.0);
|
_bottomBorder.frame = CGRectMake(0, _contentView.fs_height-weekdayHeight-weekdayMargin*2, _contentView.fs_width, 1.0);
|
||||||
|
_titleLabel.frame = CGRectMake(0, _bottomBorder.fs_bottom-titleHeight-weekdayMargin, titleWidth,titleHeight);
|
||||||
CGPoint titleHeaderOffset = self.calendar.appearance.headerTitleOffset;
|
|
||||||
_titleLabel.frame = CGRectMake(titleHeaderOffset.x,
|
|
||||||
titleHeaderOffset.y+_bottomBorder.fs_bottom-titleHeight-weekdayMargin,
|
|
||||||
titleWidth,
|
|
||||||
titleHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Properties
|
#pragma mark - Properties
|
||||||
|
|
@ -94,8 +90,6 @@
|
||||||
{
|
{
|
||||||
_titleLabel.font = self.calendar.appearance.headerTitleFont;
|
_titleLabel.font = self.calendar.appearance.headerTitleFont;
|
||||||
_titleLabel.textColor = self.calendar.appearance.headerTitleColor;
|
_titleLabel.textColor = self.calendar.appearance.headerTitleColor;
|
||||||
_titleLabel.textAlignment = self.calendar.appearance.headerTitleAlignment;
|
|
||||||
_bottomBorder.backgroundColor = self.calendar.appearance.headerSeparatorColor;
|
|
||||||
[self.weekdayView configureAppearance];
|
[self.weekdayView configureAppearance];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,16 +97,9 @@
|
||||||
{
|
{
|
||||||
_month = month;
|
_month = month;
|
||||||
_calendar.formatter.dateFormat = self.calendar.appearance.headerDateFormat;
|
_calendar.formatter.dateFormat = self.calendar.appearance.headerDateFormat;
|
||||||
BOOL usesUpperCase = (self.calendar.appearance.caseOptions & 15) == FSCalendarCaseOptionsHeaderUsesUpperCase;
|
BOOL usesUpperCase = (self.calendar.appearance.caseOptions & 15) == FSCalendarCaseOptionsHeaderUsesUpperCase;
|
||||||
BOOL usesCapitalized = (self.calendar.appearance.caseOptions & 15) == FSCalendarCaseOptionsHeaderUsesCapitalized;
|
|
||||||
|
|
||||||
NSString *text = [_calendar.formatter stringFromDate:_month];
|
NSString *text = [_calendar.formatter stringFromDate:_month];
|
||||||
if (usesUpperCase) {
|
text = usesUpperCase ? text.uppercaseString : text;
|
||||||
text = text.uppercaseString;
|
|
||||||
} else if (usesCapitalized) {
|
|
||||||
text = text.capitalizedString;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.titleLabel.text = text;
|
self.titleLabel.text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarTransitionState) {
|
||||||
|
|
||||||
- (void)performScopeTransitionFromScope:(FSCalendarScope)fromScope toScope:(FSCalendarScope)toScope animated:(BOOL)animated;
|
- (void)performScopeTransitionFromScope:(FSCalendarScope)fromScope toScope:(FSCalendarScope)toScope animated:(BOOL)animated;
|
||||||
- (void)performBoundingRectTransitionFromMonth:(NSDate *)fromMonth toMonth:(NSDate *)toMonth duration:(CGFloat)duration;
|
- (void)performBoundingRectTransitionFromMonth:(NSDate *)fromMonth toMonth:(NSDate *)toMonth duration:(CGFloat)duration;
|
||||||
|
- (void)performBoundingRectTransitionForScope:(FSCalendarScope)scope animated:(BOOL)animated;
|
||||||
- (CGRect)boundingRectForScope:(FSCalendarScope)scope page:(NSDate *)page;
|
- (CGRect)boundingRectForScope:(FSCalendarScope)scope page:(NSDate *)page;
|
||||||
|
|
||||||
- (void)handleScopeGesture:(id)sender;
|
- (void)handleScopeGesture:(id)sender;
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,37 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)performBoundingRectTransitionForScope:(FSCalendarScope)scope animated:(BOOL)animated
|
||||||
|
{
|
||||||
|
CGFloat animationDuration = (animated) ? 0.25 : 0;
|
||||||
|
|
||||||
|
FSCalendarTransitionAttributes *attr = [self createTransitionAttributesTargetingScope:FSCalendarScopeWeek];
|
||||||
|
self.transitionAttributes = attr;
|
||||||
|
|
||||||
|
[self.calendar fs_setVariable:attr.targetPage forKey:@"_currentPage"];
|
||||||
|
CGRect bounds = [self boundingRectForScope:scope page:self.calendar.currentPage];
|
||||||
|
self.state = FSCalendarTransitionStateChanging;
|
||||||
|
void (^completion)(BOOL) = ^(BOOL finished) {
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
self.state = FSCalendarTransitionStateIdle;
|
||||||
|
self.calendar.needsAdjustingViewFrame = YES;
|
||||||
|
[self.collectionView reloadData];
|
||||||
|
[self.calendar.calendarHeaderView reloadData];
|
||||||
|
[self.calendar setNeedsLayout];
|
||||||
|
[self.calendar layoutIfNeeded];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
if (FSCalendarInAppExtension) {
|
||||||
|
// Detect today extension: http://stackoverflow.com/questions/25048026/ios-8-extension-how-to-detect-running
|
||||||
|
[self boundingRectWillChange:bounds animated:YES];
|
||||||
|
completion(YES);
|
||||||
|
} else {
|
||||||
|
[UIView animateWithDuration:animationDuration delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
|
||||||
|
[self boundingRectWillChange:bounds animated:YES];
|
||||||
|
} completion:completion];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Private properties
|
#pragma mark - Private properties
|
||||||
|
|
||||||
- (void)performTransitionCompletionAnimated:(BOOL)animated
|
- (void)performTransitionCompletionAnimated:(BOOL)animated
|
||||||
|
|
@ -256,7 +287,14 @@
|
||||||
if (targetScope == FSCalendarScopeWeek) {
|
if (targetScope == FSCalendarScopeWeek) {
|
||||||
[dates addObject:self.calendar.currentPage];
|
[dates addObject:self.calendar.currentPage];
|
||||||
} else {
|
} else {
|
||||||
[dates addObject:[self.calendar.gregorian dateByAddingUnit:NSCalendarUnitDay value:3 toDate:self.calendar.currentPage options:0]];
|
//Moving from Week to Month Scope
|
||||||
|
//Get mid day of the current page
|
||||||
|
NSDate *currentPageMidDate = [self.calendar.gregorian dateByAddingUnit:NSCalendarUnitDay
|
||||||
|
value:((self.calendar.numberOfWeeks*7)/2)
|
||||||
|
toDate:self.calendar.currentPage
|
||||||
|
options:0];
|
||||||
|
|
||||||
|
[dates addObject:currentPageMidDate];
|
||||||
}
|
}
|
||||||
dates.copy;
|
dates.copy;
|
||||||
});
|
});
|
||||||
|
|
@ -274,7 +312,21 @@
|
||||||
coordinate.row;
|
coordinate.row;
|
||||||
});
|
});
|
||||||
attributes.targetPage = ({
|
attributes.targetPage = ({
|
||||||
NSDate *targetPage = targetScope == FSCalendarScopeMonth ? [self.calendar.gregorian fs_firstDayOfMonth:attributes.focusedDate] : [self.calendar.gregorian fs_middleDayOfWeek:attributes.focusedDate];
|
NSDate *targetPage;
|
||||||
|
|
||||||
|
if (targetScope == FSCalendarScopeMonth) {
|
||||||
|
targetPage = [self.calendar.gregorian fs_firstDayOfMonth:attributes.focusedDate];
|
||||||
|
} else {
|
||||||
|
//Moving from Month to Week Scope
|
||||||
|
//This should be the first day of the page
|
||||||
|
NSIndexPath *indexPath = [self.calendar.calculator indexPathForDate:attributes.focusedDate scope:FSCalendarScopeWeek];
|
||||||
|
NSDate *minimumPage = [self.calendar.gregorian fs_firstDayOfWeek:self.calendar.minimumDate];
|
||||||
|
targetPage = [self.calendar.gregorian dateByAddingUnit:NSCalendarUnitWeekOfYear
|
||||||
|
value:(indexPath.section*self.calendar.numberOfWeeks)
|
||||||
|
toDate:minimumPage
|
||||||
|
options:0];
|
||||||
|
}
|
||||||
|
|
||||||
targetPage;
|
targetPage;
|
||||||
});
|
});
|
||||||
attributes.targetBounds = [self boundingRectForScope:attributes.targetScope page:attributes.targetPage];
|
attributes.targetBounds = [self boundingRectForScope:attributes.targetScope page:attributes.targetPage];
|
||||||
|
|
|
||||||
|
|
@ -9,20 +9,18 @@
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>8.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>$(PRODUCT_NAME)</string>
|
<string>$(PRODUCT_NAME)</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2.8.3</string>
|
<string>2.8.0</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>282</string>
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>net.goout.GoOut.groupIdentifier</key>
|
|
||||||
<string>$(GROUP_IDENTIFIER)</string>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendar.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarAppearance.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarCalculator.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarCell.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarCollectionView.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarCollectionViewLayout.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarConstants.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarDelegationFactory.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarDelegationProxy.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarDynamicHeader.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarExtensions.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarHeaderView.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarSeparatorDecorationView.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarStickyHeader.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarTransitionCoordinator.h
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../FSCalendarWeekdayView.h
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>IDEDidComputeMac32BitWarning</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
// swift-tools-version:5.3
|
|
||||||
import PackageDescription
|
|
||||||
|
|
||||||
let package = Package(
|
|
||||||
name: "FSCalendar",
|
|
||||||
platforms: [.iOS(.v9)],
|
|
||||||
products: [
|
|
||||||
.library(
|
|
||||||
name: "FSCalendar",
|
|
||||||
targets: ["FSCalendar"]
|
|
||||||
),
|
|
||||||
],
|
|
||||||
targets: [
|
|
||||||
.target(
|
|
||||||
name: "FSCalendar",
|
|
||||||
dependencies: [],
|
|
||||||
path: "FSCalendar/"
|
|
||||||
)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
@ -87,13 +87,6 @@ end
|
||||||
github "WenchaoD/FSCalendar"
|
github "WenchaoD/FSCalendar"
|
||||||
```
|
```
|
||||||
|
|
||||||
## SPM:
|
|
||||||
|
|
||||||
Add dependency:
|
|
||||||
```swift
|
|
||||||
.package(url: "https://github.com/WenchaoD/FSCalendar.git", from: "2.8.3")
|
|
||||||
```
|
|
||||||
|
|
||||||
## Manually:
|
## Manually:
|
||||||
* Drag all files under `FSCalendar` folder into your project. 👍
|
* Drag all files under `FSCalendar` folder into your project. 👍
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue