Commit d4d839ba authored by Wei Han's avatar Wei Han

code update

parent 55bae677
......@@ -9,21 +9,21 @@
/* Begin PBXBuildFile section */
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
44006126336D83DB220E7214 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
6605450219E625E325860241 /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A66DA9846FC1AA1735AFC480 /* libPods-example.a */; };
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
8B0987845C560FD781B650AE /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8A2400CB7299C3614291226C /* libPods-example.a */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
0DA6F8C368328824431FC7CD /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = example/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = example/Info.plist; sourceTree = "<group>"; };
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = example/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
57196ABB0FAFEBD2B74D07C7 /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = "<group>"; };
761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = example/AppDelegate.swift; sourceTree = "<group>"; };
7B95B544AC20B8E9FBAC2BD0 /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = example/LaunchScreen.storyboard; sourceTree = "<group>"; };
8A2400CB7299C3614291226C /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E8EAD6F76E99A3EACFCAFAA5 /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = "<group>"; };
A66DA9846FC1AA1735AFC480 /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
......@@ -32,7 +32,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8B0987845C560FD781B650AE /* libPods-example.a in Frameworks */,
6605450219E625E325860241 /* libPods-example.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -55,7 +55,7 @@
isa = PBXGroup;
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
8A2400CB7299C3614291226C /* libPods-example.a */,
A66DA9846FC1AA1735AFC480 /* libPods-example.a */,
);
name = Frameworks;
sourceTree = "<group>";
......@@ -92,8 +92,8 @@
BBD78D7AC51CEA395F1C20DB /* Pods */ = {
isa = PBXGroup;
children = (
57196ABB0FAFEBD2B74D07C7 /* Pods-example.debug.xcconfig */,
E8EAD6F76E99A3EACFCAFAA5 /* Pods-example.release.xcconfig */,
0DA6F8C368328824431FC7CD /* Pods-example.debug.xcconfig */,
7B95B544AC20B8E9FBAC2BD0 /* Pods-example.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
......@@ -105,13 +105,13 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */;
buildPhases = (
345C81D5C27EE395225881EA /* [CP] Check Pods Manifest.lock */,
862A4B5823F4E4548FFDB926 /* [CP] Check Pods Manifest.lock */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
82A113167A34CAB220114EBD /* [CP] Embed Pods Frameworks */,
5366F480F3743B4AE3E10ADF /* [CP] Copy Pods Resources */,
D34D31B7F4FB69ABCE829CA8 /* [CP] Embed Pods Frameworks */,
CCE9D6684B3A7D5068209D45 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -183,7 +183,7 @@
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
};
345C81D5C27EE395225881EA /* [CP] Check Pods Manifest.lock */ = {
862A4B5823F4E4548FFDB926 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
......@@ -205,7 +205,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
5366F480F3743B4AE3E10ADF /* [CP] Copy Pods Resources */ = {
CCE9D6684B3A7D5068209D45 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
......@@ -222,7 +222,7 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
82A113167A34CAB220114EBD /* [CP] Embed Pods Frameworks */ = {
D34D31B7F4FB69ABCE829CA8 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
......@@ -255,7 +255,7 @@
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 57196ABB0FAFEBD2B74D07C7 /* Pods-example.debug.xcconfig */;
baseConfigurationReference = 0DA6F8C368328824431FC7CD /* Pods-example.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
......@@ -283,7 +283,7 @@
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = E8EAD6F76E99A3EACFCAFAA5 /* Pods-example.release.xcconfig */;
baseConfigurationReference = 7B95B544AC20B8E9FBAC2BD0 /* Pods-example.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
......
......@@ -8,32 +8,32 @@
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
......
......@@ -30,6 +30,9 @@
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
2F96476C2E86307D002CC7CB /* Exceptions for "QmsPluginFramework" folder in "QmsPluginFramework" target */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
FSCalendar/Info.plist,
);
publicHeaders = (
QmsPlugin.h,
QmsPluginFramework.h,
......
......@@ -2,7 +2,13 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface AppointmentViewMoreViewController : UIViewController
@property (nonatomic, strong) UITableView *agendaTable;
@property (nonatomic, strong) NSArray *agendaList; // appointments for selected day
@end
NS_ASSUME_NONNULL_END
......@@ -9,6 +9,7 @@
#import "IssuesViewController.h"
#import "AppointmentViewController.h"
#import "AppointmentDetailsViewController.h"
#import "AppointmentViewMoreViewController.h"
@interface DashboardViewController ()
......@@ -570,7 +571,7 @@
title.textColor = [UIColor blackColor];
title.userInteractionEnabled = YES; // 👈 enable taps
UITapGestureRecognizer *titleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sectionHeaderTapped:)];
UITapGestureRecognizer *titleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(appointmentHeaderTapped:)];
[title addGestureRecognizer:titleTap];
UIImageView *arrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_green_arrowright"]];
arrow.frame = CGRectMake(self.view.bounds.size.width - 40, 2, 24, 24);
......@@ -632,17 +633,6 @@
return section;
}
- (UILabel *)makeSectionTitle:(NSString *)titleText {
UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 200, 24)];
title.text = titleText;
title.font = [UIFont boldSystemFontOfSize:18];
title.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sectionHeaderTapped:)];
[title addGestureRecognizer:tap];
return title;
}
- (UIView *)makeAnnouncementCard:(NSDictionary *)item {
UIView *card = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 280, 100)];
card.backgroundColor = UIColor.whiteColor;
......@@ -1034,13 +1024,18 @@
NSLog(@"📘 Section tapped: %@", header.text);
}
-(void)appointmentHeaderTapped:(UITapGestureRecognizer *)gesture {
AppointmentViewMoreViewController *nextVC = [[AppointmentViewMoreViewController alloc] init];
nextVC.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:nextVC animated:YES completion:nil];
}
-(void)issueHeaderTapped:(UITapGestureRecognizer *)gesture {
IssuesViewController *nextVC = [[IssuesViewController alloc] init];
nextVC.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:nextVC animated:YES completion:nil];
}
- (void)cardTapped:(UITapGestureRecognizer *)gesture {
UIView *card = gesture.view;
[self animateTapForView:card];
......
//
// FSCalendarAppearance.h
// Pods
//
// Created by DingWenchao on 6/29/15.
// Copyright © 2016 Wenchao Ding. All rights reserved.
//
// https://github.com/WenchaoD
//
#import "FSCalendarConstants.h"
@class FSCalendar;
typedef NS_ENUM(NSInteger, FSCalendarCellState) {
FSCalendarCellStateNormal = 0,
FSCalendarCellStateSelected = 1,
FSCalendarCellStatePlaceholder = 1 << 1,
FSCalendarCellStateDisabled = 1 << 2,
FSCalendarCellStateToday = 1 << 3,
FSCalendarCellStateWeekend = 1 << 4,
FSCalendarCellStateTodaySelected = FSCalendarCellStateToday|FSCalendarCellStateSelected
};
typedef NS_ENUM(NSUInteger, FSCalendarSeparators) {
FSCalendarSeparatorNone = 0,
FSCalendarSeparatorInterRows = 1
};
typedef NS_OPTIONS(NSUInteger, FSCalendarCaseOptions) {
FSCalendarCaseOptionsHeaderUsesDefaultCase = 0,
FSCalendarCaseOptionsHeaderUsesUpperCase = 1 << 0,
FSCalendarCaseOptionsHeaderUsesCapitalized = 1 << 1,
FSCalendarCaseOptionsWeekdayUsesDefaultCase = 0 << 4,
FSCalendarCaseOptionsWeekdayUsesUpperCase = 1 << 4,
FSCalendarCaseOptionsWeekdayUsesSingleUpperCase = 2 << 4,
};
/**
* FSCalendarAppearance determines the fonts and colors of components in the calendar.
*
* @see FSCalendarDelegateAppearance
*/
@interface FSCalendarAppearance : NSObject
/**
* The font of the day text.
*/
@property (strong, nonatomic) UIFont *titleFont;
/**
* The font of the subtitle text.
*/
@property (strong, nonatomic) UIFont *subtitleFont;
/**
* The font of the weekday text.
*/
@property (strong, nonatomic) UIFont *weekdayFont;
/**
* The font of the month text.
*/
@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.
*/
@property (assign, nonatomic) CGPoint titleOffset;
/**
* The offset of the day text from default position.
*/
@property (assign, nonatomic) CGPoint subtitleOffset;
/**
* The offset of the event dots from default position.
*/
@property (assign, nonatomic) CGPoint eventOffset;
/**
* The offset of the image from default position.
*/
@property (assign, nonatomic) CGPoint imageOffset;
/**
* The color of event dots.
*/
@property (strong, nonatomic) UIColor *eventDefaultColor;
/**
* The color of event dots.
*/
@property (strong, nonatomic) UIColor *eventSelectionColor;
/**
* The color of weekday text.
*/
@property (strong, nonatomic) UIColor *weekdayTextColor;
/**
* The color of month header text.
*/
@property (strong, nonatomic) UIColor *headerTitleColor;
/**
* The color oh month header separator
*/
@property (strong, nonatomic) UIColor *headerSeparatorColor;
/**
* The date format of the month header.
*/
@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.
*/
@property (assign, nonatomic) CGFloat headerMinimumDissolvedAlpha;
/**
* The day text color for unselected state.
*/
@property (strong, nonatomic) UIColor *titleDefaultColor;
/**
* The day text color for selected state.
*/
@property (strong, nonatomic) UIColor *titleSelectionColor;
/**
* The day text color for today in the calendar.
*/
@property (strong, nonatomic) UIColor *titleTodayColor;
/**
* The day text color for days out of current month.
*/
@property (strong, nonatomic) UIColor *titlePlaceholderColor;
/**
* The day text color for weekend.
*/
@property (strong, nonatomic) UIColor *titleWeekendColor;
/**
* The subtitle text color for unselected state.
*/
@property (strong, nonatomic) UIColor *subtitleDefaultColor;
/**
* The subtitle text color for selected state.
*/
@property (strong, nonatomic) UIColor *subtitleSelectionColor;
/**
* The subtitle text color for today in the calendar.
*/
@property (strong, nonatomic) UIColor *subtitleTodayColor;
/**
* The subtitle text color for days out of current month.
*/
@property (strong, nonatomic) UIColor *subtitlePlaceholderColor;
/**
* The subtitle text color for weekend.
*/
@property (strong, nonatomic) UIColor *subtitleWeekendColor;
/**
* The fill color of the shape for selected state.
*/
@property (strong, nonatomic) UIColor *selectionColor;
/**
* The fill color of the shape for today.
*/
@property (strong, nonatomic) UIColor *todayColor;
/**
* The fill color of the shape for today and selected state.
*/
@property (strong, nonatomic) UIColor *todaySelectionColor;
/**
* The border color of the shape for unselected state.
*/
@property (strong, nonatomic) UIColor *borderDefaultColor;
/**
* The border color of the shape for selected state.
*/
@property (strong, nonatomic) UIColor *borderSelectionColor;
/**
* The border radius, while 1 means a circle, 0 means a rectangle, and the middle value will give it a corner radius.
*/
@property (assign, nonatomic) CGFloat borderRadius;
/**
* The case options manage the case of month label and weekday symbols.
*
* @see FSCalendarCaseOptions
*/
@property (assign, nonatomic) FSCalendarCaseOptions caseOptions;
/**
* The line integrations for calendar.
*
*/
@property (assign, nonatomic) FSCalendarSeparators separators;
#if TARGET_INTERFACE_BUILDER
// For preview only
@property (assign, nonatomic) BOOL fakeSubtitles;
@property (assign, nonatomic) BOOL fakeEventDots;
@property (assign, nonatomic) NSInteger fakedSelectedDay;
#endif
@end
//
// FSCalendarCalculator.h
// FSCalendar
//
// Created by dingwenchao on 30/10/2016.
// Copyright © 2016 Wenchao Ding. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
struct FSCalendarCoordinate {
NSInteger row;
NSInteger column;
};
typedef struct FSCalendarCoordinate FSCalendarCoordinate;
@interface FSCalendarCalculator : NSObject
@property (weak , nonatomic) FSCalendar *calendar;
@property (readonly, nonatomic) NSInteger numberOfSections;
- (instancetype)initWithCalendar:(FSCalendar *)calendar;
- (NSDate *)safeDateForDate:(NSDate *)date;
- (NSDate *)dateForIndexPath:(NSIndexPath *)indexPath;
- (NSDate *)dateForIndexPath:(NSIndexPath *)indexPath scope:(FSCalendarScope)scope;
- (NSIndexPath *)indexPathForDate:(NSDate *)date;
- (NSIndexPath *)indexPathForDate:(NSDate *)date scope:(FSCalendarScope)scope;
- (NSIndexPath *)indexPathForDate:(NSDate *)date atMonthPosition:(FSCalendarMonthPosition)position;
- (NSIndexPath *)indexPathForDate:(NSDate *)date atMonthPosition:(FSCalendarMonthPosition)position scope:(FSCalendarScope)scope;
- (NSDate *)pageForSection:(NSInteger)section;
- (NSDate *)weekForSection:(NSInteger)section;
- (NSDate *)monthForSection:(NSInteger)section;
- (NSDate *)monthHeadForSection:(NSInteger)section;
- (NSInteger)numberOfHeadPlaceholdersForMonth:(NSDate *)month;
- (NSInteger)numberOfRowsInMonth:(NSDate *)month;
- (NSInteger)numberOfRowsInSection:(NSInteger)section;
- (FSCalendarMonthPosition)monthPositionForIndexPath:(NSIndexPath *)indexPath;
- (FSCalendarCoordinate)coordinateForIndexPath:(NSIndexPath *)indexPath;
- (void)reloadSections;
@end
//
// FSCalendarCell.h
// Pods
//
// Created by Wenchao Ding on 12/3/15.
//
//
#import <UIKit/UIKit.h>
@class FSCalendar, FSCalendarAppearance, FSCalendarEventIndicator;
typedef NS_ENUM(NSUInteger, FSCalendarMonthPosition);
@interface FSCalendarCell : UICollectionViewCell
#pragma mark - Public properties
/**
The day text label of the cell
*/
@property (weak, nonatomic) UILabel *titleLabel;
/**
The subtitle label of the cell
*/
@property (weak, nonatomic) UILabel *subtitleLabel;
/**
The shape layer of the cell
*/
@property (weak, nonatomic) CAShapeLayer *shapeLayer;
/**
The imageView below shape layer of the cell
*/
@property (weak, nonatomic) UIImageView *imageView;
/**
The collection of event dots of the cell
*/
@property (weak, nonatomic) FSCalendarEventIndicator *eventIndicator;
/**
A boolean value indicates that whether the cell is "placeholder". Default is NO.
*/
@property (assign, nonatomic, getter=isPlaceholder) BOOL placeholder;
#pragma mark - Private properties
@property (weak, nonatomic) FSCalendar *calendar;
@property (weak, nonatomic) FSCalendarAppearance *appearance;
@property (strong, nonatomic) NSString *subtitle;
@property (strong, nonatomic) UIImage *image;
@property (assign, nonatomic) FSCalendarMonthPosition monthPosition;
@property (assign, nonatomic) NSInteger numberOfEvents;
@property (assign, nonatomic) BOOL dateIsToday;
@property (assign, nonatomic) BOOL weekend;
@property (strong, nonatomic) UIColor *preferredFillDefaultColor;
@property (strong, nonatomic) UIColor *preferredFillSelectionColor;
@property (strong, nonatomic) UIColor *preferredTitleDefaultColor;
@property (strong, nonatomic) UIColor *preferredTitleSelectionColor;
@property (strong, nonatomic) UIColor *preferredSubtitleDefaultColor;
@property (strong, nonatomic) UIColor *preferredSubtitleSelectionColor;
@property (strong, nonatomic) UIColor *preferredBorderDefaultColor;
@property (strong, nonatomic) UIColor *preferredBorderSelectionColor;
@property (assign, nonatomic) CGPoint preferredTitleOffset;
@property (assign, nonatomic) CGPoint preferredSubtitleOffset;
@property (assign, nonatomic) CGPoint preferredImageOffset;
@property (assign, nonatomic) CGPoint preferredEventOffset;
@property (strong, nonatomic) NSArray<UIColor *> *preferredEventDefaultColors;
@property (strong, nonatomic) NSArray<UIColor *> *preferredEventSelectionColors;
@property (assign, nonatomic) CGFloat preferredBorderRadius;
// Add subviews to self.contentView and set up constraints
- (instancetype)initWithFrame:(CGRect)frame NS_REQUIRES_SUPER;
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_REQUIRES_SUPER;
// For DIY overridden
- (void)layoutSubviews NS_REQUIRES_SUPER; // Configure frames of subviews
- (void)configureAppearance NS_REQUIRES_SUPER; // Configure appearance for cell
- (UIColor *)colorForCurrentStateInDictionary:(NSDictionary *)dictionary;
- (void)performSelecting;
@end
@interface FSCalendarEventIndicator : UIView
@property (assign, nonatomic) NSInteger numberOfEvents;
@property (strong, nonatomic) id color;
@end
@interface FSCalendarBlankCell : UICollectionViewCell
- (void)configureAppearance;
@end
//
// FSCalendarCollectionView.h
// FSCalendar
//
// Created by Wenchao Ding on 10/25/15.
// Copyright (c) 2015 Wenchao Ding. All rights reserved.
//
#import <UIKit/UIKit.h>
@class FSCalendarCollectionView;
@protocol FSCalendarCollectionViewInternalDelegate <UICollectionViewDelegate>
@optional
- (void)collectionViewDidFinishLayoutSubviews:(FSCalendarCollectionView *)collectionView;
@end
@interface FSCalendarCollectionView : UICollectionView
@property (weak, nonatomic) id<FSCalendarCollectionViewInternalDelegate> internalDelegate;
@end
//
// FSCalendarCollectionView.m
// FSCalendar
//
// Created by Wenchao Ding on 10/25/15.
// Copyright (c) 2015 Wenchao Ding. All rights reserved.
//
// Reject -[UIScrollView(UIScrollViewInternal) _adjustContentOffsetIfNecessary]
#import "FSCalendarCollectionView.h"
#import "FSCalendarExtensions.h"
#import "FSCalendarConstants.h"
@interface FSCalendarCollectionView ()
- (void)commonInit;
@end
@implementation FSCalendarCollectionView
@synthesize scrollsToTop = _scrollsToTop, contentInset = _contentInset;
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
{
self = [super initWithFrame:frame collectionViewLayout:layout];
if (self) {
[self commonInit];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self commonInit];
}
return self;
}
- (void)commonInit
{
self.scrollsToTop = NO;
self.contentInset = UIEdgeInsetsZero;
if (@available(iOS 10.0, *)) self.prefetchingEnabled = NO;
if (@available(iOS 11.0, *)) self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
- (void)layoutSubviews
{
[super layoutSubviews];
if (self.internalDelegate && [self.internalDelegate respondsToSelector:@selector(collectionViewDidFinishLayoutSubviews:)]) {
[self.internalDelegate collectionViewDidFinishLayoutSubviews:self];
}
}
- (void)setContentInset:(UIEdgeInsets)contentInset
{
[super setContentInset:UIEdgeInsetsZero];
if (contentInset.top) {
self.contentOffset = CGPointMake(self.contentOffset.x, self.contentOffset.y+contentInset.top);
}
}
- (void)setScrollsToTop:(BOOL)scrollsToTop
{
[super setScrollsToTop:NO];
}
@end
//
// FSCalendarAnimationLayout.h
// FSCalendar
//
// Created by dingwenchao on 1/3/16.
// Copyright © 2016 Wenchao Ding. All rights reserved.
//
#import <UIKit/UIKit.h>
@class FSCalendar;
@interface FSCalendarCollectionViewLayout : UICollectionViewLayout
@property (weak, nonatomic) FSCalendar *calendar;
@property (assign, nonatomic) UIEdgeInsets sectionInsets;
@property (assign, nonatomic) UICollectionViewScrollDirection scrollDirection;
@end
//
// FSCalendarConstants.h
// FSCalendar
//
// Created by dingwenchao on 8/28/15.
// Copyright © 2016 Wenchao Ding. All rights reserved.
//
// https://github.com/WenchaoD
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#pragma mark - Constants
CG_EXTERN CGFloat const FSCalendarStandardHeaderHeight;
CG_EXTERN CGFloat const FSCalendarStandardWeekdayHeight;
CG_EXTERN CGFloat const FSCalendarStandardMonthlyPageHeight;
CG_EXTERN CGFloat const FSCalendarStandardWeeklyPageHeight;
CG_EXTERN CGFloat const FSCalendarStandardCellDiameter;
CG_EXTERN CGFloat const FSCalendarStandardSeparatorThickness;
CG_EXTERN CGFloat const FSCalendarAutomaticDimension;
CG_EXTERN CGFloat const FSCalendarDefaultBounceAnimationDuration;
CG_EXTERN CGFloat const FSCalendarStandardRowHeight;
CG_EXTERN CGFloat const FSCalendarStandardTitleTextSize;
CG_EXTERN CGFloat const FSCalendarStandardSubtitleTextSize;
CG_EXTERN CGFloat const FSCalendarStandardWeekdayTextSize;
CG_EXTERN CGFloat const FSCalendarStandardHeaderTextSize;
CG_EXTERN CGFloat const FSCalendarMaximumEventDotDiameter;
UIKIT_EXTERN NSInteger const FSCalendarDefaultHourComponent;
UIKIT_EXTERN NSInteger const FSCalendarMaximumNumberOfEvents;
UIKIT_EXTERN NSString * const FSCalendarDefaultCellReuseIdentifier;
UIKIT_EXTERN NSString * const FSCalendarBlankCellReuseIdentifier;
UIKIT_EXTERN NSString * const FSCalendarInvalidArgumentsExceptionName;
CG_EXTERN CGPoint const CGPointInfinity;
CG_EXTERN CGSize const CGSizeAutomatic;
#if TARGET_INTERFACE_BUILDER
#define FSCalendarDeviceIsIPad NO
#else
#define FSCalendarDeviceIsIPad [[UIDevice currentDevice].model hasPrefix:@"iPad"]
#endif
#define FSCalendarStandardSelectionColor FSColorRGBA(31,119,219,1.0)
#define FSCalendarStandardTodayColor FSColorRGBA(198,51,42 ,1.0)
#define FSCalendarStandardTitleTextColor FSColorRGBA(14,69,221 ,1.0)
#define FSCalendarStandardEventDotColor FSColorRGBA(31,119,219,0.75)
#define FSCalendarStandardLineColor [[UIColor lightGrayColor] colorWithAlphaComponent:0.30]
#define FSCalendarStandardSeparatorColor [[UIColor lightGrayColor] colorWithAlphaComponent:0.60]
#define FSColorRGBA(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define FSCalendarInAppExtension [[[NSBundle mainBundle] bundlePath] hasSuffix:@".appex"]
#define FSCalendarFloor(c) floorf(c)
#define FSCalendarRound(c) roundf(c)
#define FSCalendarCeil(c) ceilf(c)
#define FSCalendarMod(c1,c2) fmodf(c1,c2)
#define FSCalendarHalfRound(c) (FSCalendarRound(c*2)*0.5)
#define FSCalendarHalfFloor(c) (FSCalendarFloor(c*2)*0.5)
#define FSCalendarHalfCeil(c) (FSCalendarCeil(c*2)*0.5)
#define FSCalendarUseWeakSelf __weak __typeof__(self) FSCalendarWeakSelf = self;
#define FSCalendarUseStrongSelf __strong __typeof__(self) self = FSCalendarWeakSelf;
#pragma mark - Deprecated
#define FSCalendarDeprecated(instead) DEPRECATED_MSG_ATTRIBUTE(" Use " # instead " instead")
static inline void FSCalendarSliceCake(CGFloat cake, NSInteger count, CGFloat *pieces) {
CGFloat total = cake;
for (int i = 0; i < count; i++) {
NSInteger remains = count - i;
CGFloat piece = FSCalendarRound(total/remains*2)*0.5;
total -= piece;
pieces[i] = piece;
}
}
//
// FSCalendarConstants.m
// FSCalendar
//
// Created by dingwenchao on 8/28/15.
// Copyright © 2016 Wenchao Ding. All rights reserved.
//
// https://github.com/WenchaoD
//
#import "FSCalendarConstants.h"
CGFloat const FSCalendarStandardHeaderHeight = 40;
CGFloat const FSCalendarStandardWeekdayHeight = 25;
CGFloat const FSCalendarStandardMonthlyPageHeight = 300.0;
CGFloat const FSCalendarStandardWeeklyPageHeight = 108+1/3.0;
CGFloat const FSCalendarStandardCellDiameter = 100/3.0;
CGFloat const FSCalendarStandardSeparatorThickness = 0.5;
CGFloat const FSCalendarAutomaticDimension = -1;
CGFloat const FSCalendarDefaultBounceAnimationDuration = 0.15;
CGFloat const FSCalendarStandardRowHeight = 38;
CGFloat const FSCalendarStandardTitleTextSize = 13.5;
CGFloat const FSCalendarStandardSubtitleTextSize = 10;
CGFloat const FSCalendarStandardWeekdayTextSize = 14;
CGFloat const FSCalendarStandardHeaderTextSize = 16.5;
CGFloat const FSCalendarMaximumEventDotDiameter = 4.8;
NSInteger const FSCalendarDefaultHourComponent = 0;
NSInteger const FSCalendarMaximumNumberOfEvents = 3;
NSString * const FSCalendarDefaultCellReuseIdentifier = @"_FSCalendarDefaultCellReuseIdentifier";
NSString * const FSCalendarBlankCellReuseIdentifier = @"_FSCalendarBlankCellReuseIdentifier";
NSString * const FSCalendarInvalidArgumentsExceptionName = @"Invalid argument exception";
CGPoint const CGPointInfinity = {
.x = CGFLOAT_MAX,
.y = CGFLOAT_MAX
};
CGSize const CGSizeAutomatic = {
.width = FSCalendarAutomaticDimension,
.height = FSCalendarAutomaticDimension
};
//
// FSCalendarDelegationFactory.h
// FSCalendar
//
// Created by dingwenchao on 19/12/2016.
// Copyright © 2016 wenchaoios. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "FSCalendarDelegationProxy.h"
@interface FSCalendarDelegationFactory : NSObject
+ (FSCalendarDelegationProxy *)dataSourceProxy;
+ (FSCalendarDelegationProxy *)delegateProxy;
@end
//
// FSCalendarDelegationFactory.m
// FSCalendar
//
// Created by dingwenchao on 19/12/2016.
// Copyright © 2016 wenchaoios. All rights reserved.
//
#import "FSCalendarDelegationFactory.h"
@implementation FSCalendarDelegationFactory
+ (FSCalendarDelegationProxy *)dataSourceProxy
{
FSCalendarDelegationProxy *delegation = [[FSCalendarDelegationProxy alloc] init];
delegation.protocol = @protocol(FSCalendarDataSource);
return delegation;
}
+ (FSCalendarDelegationProxy *)delegateProxy
{
FSCalendarDelegationProxy *delegation = [[FSCalendarDelegationProxy alloc] init];
delegation.protocol = @protocol(FSCalendarDelegateAppearance);
return delegation;
}
@end
#undef FSCalendarSelectorEntry
//
// FSCalendarDelegationProxy.h
// FSCalendar
//
// Created by dingwenchao on 11/12/2016.
// Copyright © 2016 Wenchao Ding. All rights reserved.
//
// https://github.com/WenchaoD
//
// 1. Smart proxy delegation http://petersteinberger.com/blog/2013/smart-proxy-delegation/
// 2. Manage deprecated delegation functions
//
#import <Foundation/Foundation.h>
#import "FSCalendar.h"
NS_ASSUME_NONNULL_BEGIN
@interface FSCalendarDelegationProxy : NSProxy
@property (weak , nonatomic) id delegation;
@property (strong, nonatomic) Protocol *protocol;
@property (strong, nonatomic) NSDictionary<NSString *,NSString *> *deprecations;
- (instancetype)init;
- (SEL)deprecatedSelectorOfSelector:(SEL)selector;
@end
NS_ASSUME_NONNULL_END
//
// FSCalendarDelegationProxy.m
// FSCalendar
//
// Created by dingwenchao on 11/12/2016.
// Copyright © 2016 Wenchao Ding. All rights reserved.
//
#import "FSCalendarDelegationProxy.h"
#import <objc/runtime.h>
@implementation FSCalendarDelegationProxy
- (instancetype)init
{
return self;
}
- (BOOL)respondsToSelector:(SEL)selector
{
BOOL responds = [self.delegation respondsToSelector:selector];
if (!responds) responds = [self.delegation respondsToSelector:[self deprecatedSelectorOfSelector:selector]];
if (!responds) responds = [super respondsToSelector:selector];
return responds;
}
- (BOOL)conformsToProtocol:(Protocol *)protocol
{
return [self.delegation conformsToProtocol:protocol];
}
- (void)forwardInvocation:(NSInvocation *)invocation
{
SEL selector = invocation.selector;
if (![self.delegation respondsToSelector:selector]) {
selector = [self deprecatedSelectorOfSelector:selector];
invocation.selector = selector;
}
if ([self.delegation respondsToSelector:selector]) {
[invocation invokeWithTarget:self.delegation];
}
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel
{
if ([self.delegation respondsToSelector:sel]) {
return [(NSObject *)self.delegation methodSignatureForSelector:sel];
}
SEL selector = [self deprecatedSelectorOfSelector:sel];
if ([self.delegation respondsToSelector:selector]) {
return [(NSObject *)self.delegation methodSignatureForSelector:selector];
}
#if TARGET_INTERFACE_BUILDER
return [NSObject methodSignatureForSelector:@selector(init)];
#else
struct objc_method_description desc = protocol_getMethodDescription(self.protocol, sel, NO, YES);
const char *types = desc.types;
return types?[NSMethodSignature signatureWithObjCTypes:types]:[NSObject methodSignatureForSelector:@selector(init)];
#endif
}
- (SEL)deprecatedSelectorOfSelector:(SEL)selector
{
NSString *selectorString = NSStringFromSelector(selector);
selectorString = self.deprecations[selectorString];
return NSSelectorFromString(selectorString);
}
@end
//
// FSCalendarDynamicHeader.h
// Pods
//
// Created by DingWenchao on 6/29/15.
//
// 动感头文件,仅供框架内部使用。
// Private header, don't use it.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "FSCalendar.h"
#import "FSCalendarCell.h"
#import "FSCalendarHeaderView.h"
#import "FSCalendarStickyHeader.h"
#import "FSCalendarCollectionView.h"
#import "FSCalendarCollectionViewLayout.h"
#import "FSCalendarCalculator.h"
#import "FSCalendarTransitionCoordinator.h"
#import "FSCalendarDelegationProxy.h"
@interface FSCalendar (Dynamic)
@property (readonly, nonatomic) FSCalendarCollectionView *collectionView;
@property (readonly, nonatomic) FSCalendarCollectionViewLayout *collectionViewLayout;
@property (readonly, nonatomic) FSCalendarTransitionCoordinator *transitionCoordinator;
@property (readonly, nonatomic) FSCalendarCalculator *calculator;
@property (readonly, nonatomic) BOOL floatingMode;
@property (readonly, nonatomic) NSArray *visibleStickyHeaders;
@property (readonly, nonatomic) CGFloat preferredHeaderHeight;
@property (readonly, nonatomic) CGFloat preferredWeekdayHeight;
@property (readonly, nonatomic) NSCalendar *gregorian;
@property (readonly, nonatomic) NSDateFormatter *formatter;
@property (readonly, nonatomic) UIView *contentView;
@property (readonly, nonatomic) UIView *daysContainer;
@property (assign, nonatomic) BOOL needsAdjustingViewFrame;
- (void)adjustMonthPosition;
- (void)configureAppearance;
- (CGSize)sizeThatFits:(CGSize)size scope:(FSCalendarScope)scope;
@end
@interface FSCalendarAppearance (Dynamic)
@property (readwrite, nonatomic) FSCalendar *calendar;
@property (readonly, nonatomic) NSDictionary *backgroundColors;
@property (readonly, nonatomic) NSDictionary *titleColors;
@property (readonly, nonatomic) NSDictionary *subtitleColors;
@property (readonly, nonatomic) NSDictionary *borderColors;
@end
@interface FSCalendarWeekdayView (Dynamic)
@property (readwrite, nonatomic) FSCalendar *calendar;
@end
@interface FSCalendarCollectionViewLayout (Dynamic)
@property (readonly, nonatomic) CGSize estimatedItemSize;
@end
@interface FSCalendarDelegationProxy()<FSCalendarDataSource,FSCalendarDelegate,FSCalendarDelegateAppearance>
@end
//
// FSCalendarExtensions.h
// FSCalendar
//
// Created by dingwenchao on 10/8/16.
// Copyright © 2016 Wenchao Ding. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIView (FSCalendarExtensions)
@property (nonatomic) CGFloat fs_width;
@property (nonatomic) CGFloat fs_height;
@property (nonatomic) CGFloat fs_top;
@property (nonatomic) CGFloat fs_left;
@property (nonatomic) CGFloat fs_bottom;
@property (nonatomic) CGFloat fs_right;
@end
@interface CALayer (FSCalendarExtensions)
@property (nonatomic) CGFloat fs_width;
@property (nonatomic) CGFloat fs_height;
@property (nonatomic) CGFloat fs_top;
@property (nonatomic) CGFloat fs_left;
@property (nonatomic) CGFloat fs_bottom;
@property (nonatomic) CGFloat fs_right;
@end
@interface NSCalendar (FSCalendarExtensions)
- (nullable NSDate *)fs_firstDayOfMonth:(NSDate *)month;
- (nullable NSDate *)fs_lastDayOfMonth:(NSDate *)month;
- (nullable NSDate *)fs_firstDayOfWeek:(NSDate *)week;
- (nullable NSDate *)fs_lastDayOfWeek:(NSDate *)week;
- (nullable NSDate *)fs_middleDayOfWeek:(NSDate *)week;
- (NSInteger)fs_numberOfDaysInMonth:(NSDate *)month;
@end
@interface NSMapTable (FSCalendarExtensions)
- (void)setObject:(nullable id)obj forKeyedSubscript:(id<NSCopying>)key;
- (id)objectForKeyedSubscript:(id<NSCopying>)key;
@end
@interface NSCache (FSCalendarExtensions)
- (void)setObject:(nullable id)obj forKeyedSubscript:(id<NSCopying>)key;
- (id)objectForKeyedSubscript:(id<NSCopying>)key;
@end
@interface NSObject (FSCalendarExtensions)
#define IVAR_DEF(SET,GET,TYPE) \
- (void)fs_set##SET##Variable:(TYPE)value forKey:(NSString *)key; \
- (TYPE)fs_##GET##VariableForKey:(NSString *)key;
IVAR_DEF(Bool, bool, BOOL)
IVAR_DEF(Float, float, CGFloat)
IVAR_DEF(Integer, integer, NSInteger)
IVAR_DEF(UnsignedInteger, unsignedInteger, NSUInteger)
#undef IVAR_DEF
- (void)fs_setVariable:(id)variable forKey:(NSString *)key;
- (id)fs_variableForKey:(NSString *)key;
- (nullable id)fs_performSelector:(SEL)selector withObjects:(nullable id)firstObject, ... NS_REQUIRES_NIL_TERMINATION;
@end
NS_ASSUME_NONNULL_END
//
// FSCalendarHeader.h
// Pods
//
// Created by Wenchao Ding on 29/1/15.
//
//
#import <UIKit/UIKit.h>
@class FSCalendar, FSCalendarAppearance, FSCalendarHeaderLayout, FSCalendarCollectionView;
@interface FSCalendarHeaderView : UIView
@property (weak, nonatomic) FSCalendarCollectionView *collectionView;
@property (weak, nonatomic) FSCalendarHeaderLayout *collectionViewLayout;
@property (weak, nonatomic) FSCalendar *calendar;
@property (assign, nonatomic) UICollectionViewScrollDirection scrollDirection;
@property (assign, nonatomic) BOOL scrollEnabled;
- (void)setScrollOffset:(CGFloat)scrollOffset;
- (void)setScrollOffset:(CGFloat)scrollOffset animated:(BOOL)animated;
- (void)reloadData;
- (void)configureAppearance;
@end
@interface FSCalendarHeaderCell : UICollectionViewCell
@property (weak, nonatomic) UILabel *titleLabel;
@property (weak, nonatomic) FSCalendarHeaderView *header;
@end
@interface FSCalendarHeaderLayout : UICollectionViewFlowLayout
@end
@interface FSCalendarHeaderTouchDeliver : UIView
@property (weak, nonatomic) FSCalendar *calendar;
@property (weak, nonatomic) FSCalendarHeaderView *header;
@end
//
// FSCalendarSeparatorDecorationView.h
// FSCalendar
//
// Created by 丁文超 on 2018/10/10.
// Copyright © 2018 wenchaoios. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface FSCalendarSeparatorDecorationView : UICollectionReusableView
@end
NS_ASSUME_NONNULL_END
//
// FSCalendarSeparatorDecorationView.m
// FSCalendar
//
// Created by 丁文超 on 2018/10/10.
// Copyright © 2018 wenchaoios. All rights reserved.
//
#import "FSCalendarSeparatorDecorationView.h"
#import "FSCalendarConstants.h"
@implementation FSCalendarSeparatorDecorationView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = FSCalendarStandardSeparatorColor;
}
return self;
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
self.frame = layoutAttributes.frame;
}
@end
//
// FSCalendarStaticHeader.h
// FSCalendar
//
// Created by dingwenchao on 9/17/15.
// Copyright (c) 2015 Wenchao Ding. All rights reserved.
//
#import <UIKit/UIKit.h>
@class FSCalendar,FSCalendarAppearance;
@interface FSCalendarStickyHeader : UICollectionReusableView
@property (weak, nonatomic) FSCalendar *calendar;
@property (weak, nonatomic) UILabel *titleLabel;
@property (strong, nonatomic) NSDate *month;
- (void)configureAppearance;
@end
//
// FSCalendarStaticHeader.m
// FSCalendar
//
// Created by dingwenchao on 9/17/15.
// Copyright (c) 2015 Wenchao Ding. All rights reserved.
//
#import "FSCalendarStickyHeader.h"
#import "FSCalendar.h"
#import "FSCalendarWeekdayView.h"
#import "FSCalendarExtensions.h"
#import "FSCalendarConstants.h"
#import "FSCalendarDynamicHeader.h"
@interface FSCalendarStickyHeader ()
@property (weak , nonatomic) UIView *contentView;
@property (weak , nonatomic) UIView *bottomBorder;
@property (weak , nonatomic) FSCalendarWeekdayView *weekdayView;
@end
@implementation FSCalendarStickyHeader
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
UIView *view;
UILabel *label;
view = [[UIView alloc] initWithFrame:CGRectZero];
view.backgroundColor = [UIColor clearColor];
[self addSubview:view];
self.contentView = view;
label = [[UILabel alloc] initWithFrame:CGRectZero];
label.textAlignment = NSTextAlignmentCenter;
label.numberOfLines = 0;
[_contentView addSubview:label];
self.titleLabel = label;
view = [[UIView alloc] initWithFrame:CGRectZero];
view.backgroundColor = FSCalendarStandardLineColor;
[_contentView addSubview:view];
self.bottomBorder = view;
FSCalendarWeekdayView *weekdayView = [[FSCalendarWeekdayView alloc] init];
[self.contentView addSubview:weekdayView];
self.weekdayView = weekdayView;
}
return self;
}
- (void)layoutSubviews
{
[super layoutSubviews];
_contentView.frame = self.bounds;
CGFloat weekdayHeight = _calendar.preferredWeekdayHeight;
CGFloat weekdayMargin = weekdayHeight * 0.1;
CGFloat titleWidth = _contentView.fs_width;
self.weekdayView.frame = CGRectMake(0, _contentView.fs_height-weekdayHeight-weekdayMargin, self.contentView.fs_width, weekdayHeight);
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);
CGPoint titleHeaderOffset = self.calendar.appearance.headerTitleOffset;
_titleLabel.frame = CGRectMake(titleHeaderOffset.x,
titleHeaderOffset.y+_bottomBorder.fs_bottom-titleHeight-weekdayMargin,
titleWidth,
titleHeight);
}
#pragma mark - Properties
- (void)setCalendar:(FSCalendar *)calendar
{
if (![_calendar isEqual:calendar]) {
_calendar = calendar;
_weekdayView.calendar = calendar;
[self configureAppearance];
}
}
#pragma mark - Private methods
- (void)configureAppearance
{
_titleLabel.font = self.calendar.appearance.headerTitleFont;
_titleLabel.textColor = self.calendar.appearance.headerTitleColor;
_titleLabel.textAlignment = self.calendar.appearance.headerTitleAlignment;
_bottomBorder.backgroundColor = self.calendar.appearance.headerSeparatorColor;
[self.weekdayView configureAppearance];
}
- (void)setMonth:(NSDate *)month
{
_month = month;
_calendar.formatter.dateFormat = self.calendar.appearance.headerDateFormat;
BOOL usesUpperCase = (self.calendar.appearance.caseOptions & 15) == FSCalendarCaseOptionsHeaderUsesUpperCase;
BOOL usesCapitalized = (self.calendar.appearance.caseOptions & 15) == FSCalendarCaseOptionsHeaderUsesCapitalized;
NSString *text = [_calendar.formatter stringFromDate:_month];
if (usesUpperCase) {
text = text.uppercaseString;
} else if (usesCapitalized) {
text = text.capitalizedString;
}
self.titleLabel.text = text;
}
@end
//
// FSCalendarTransitionCoordinator.h
// FSCalendar
//
// Created by dingwenchao on 3/13/16.
// Copyright © 2016 Wenchao Ding. All rights reserved.
//
#import "FSCalendar.h"
#import "FSCalendarCollectionView.h"
#import "FSCalendarCollectionViewLayout.h"
typedef NS_ENUM(NSUInteger, FSCalendarTransitionState) {
FSCalendarTransitionStateIdle,
FSCalendarTransitionStateChanging,
FSCalendarTransitionStateFinishing,
};
@interface FSCalendarTransitionCoordinator : NSObject <UIGestureRecognizerDelegate>
@property (assign, nonatomic) FSCalendarTransitionState state;
@property (assign, nonatomic) CGSize cachedMonthSize;
@property (readonly, nonatomic) FSCalendarScope representingScope;
- (instancetype)initWithCalendar:(FSCalendar *)calendar;
- (void)performScopeTransitionFromScope:(FSCalendarScope)fromScope toScope:(FSCalendarScope)toScope animated:(BOOL)animated;
- (void)performBoundingRectTransitionFromMonth:(NSDate *)fromMonth toMonth:(NSDate *)toMonth duration:(CGFloat)duration;
- (CGRect)boundingRectForScope:(FSCalendarScope)scope page:(NSDate *)page;
- (void)handleScopeGesture:(id)sender;
@end
@interface FSCalendarTransitionAttributes : NSObject
@property (assign, nonatomic) CGRect sourceBounds;
@property (assign, nonatomic) CGRect targetBounds;
@property (strong, nonatomic) NSDate *sourcePage;
@property (strong, nonatomic) NSDate *targetPage;
@property (assign, nonatomic) NSInteger focusedRow;
@property (strong, nonatomic) NSDate *focusedDate;
@property (assign, nonatomic) FSCalendarScope targetScope;
- (void)revert;
@end
//
// FSCalendarWeekdayView.h
// FSCalendar
//
// Created by dingwenchao on 03/11/2016.
// Copyright © 2016 dingwenchao. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class FSCalendar;
@interface FSCalendarWeekdayView : UIView
/**
An array of UILabel objects displaying the weekday symbols.
*/
@property (readonly, nonatomic) NSArray<UILabel *> *weekdayLabels;
- (void)configureAppearance;
@end
NS_ASSUME_NONNULL_END
//
// FSCalendarWeekdayView.m
// FSCalendar
//
// Created by dingwenchao on 03/11/2016.
// Copyright © 2016 Wenchao Ding. All rights reserved.
//
#import "FSCalendarWeekdayView.h"
#import "FSCalendar.h"
#import "FSCalendarDynamicHeader.h"
#import "FSCalendarExtensions.h"
@interface FSCalendarWeekdayView()
@property (strong, nonatomic) NSPointerArray *weekdayPointers;
@property (weak , nonatomic) UIView *contentView;
@property (weak , nonatomic) FSCalendar *calendar;
- (void)commonInit;
@end
@implementation FSCalendarWeekdayView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self commonInit];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self commonInit];
}
return self;
}
- (void)commonInit
{
UIView *contentView = [[UIView alloc] initWithFrame:CGRectZero];
[self addSubview:contentView];
_contentView = contentView;
_weekdayPointers = [NSPointerArray weakObjectsPointerArray];
for (int i = 0; i < 7; i++) {
UILabel *weekdayLabel = [[UILabel alloc] initWithFrame:CGRectZero];
weekdayLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:weekdayLabel];
[_weekdayPointers addPointer:(__bridge void * _Nullable)(weekdayLabel)];
}
}
- (void)layoutSubviews
{
[super layoutSubviews];
self.contentView.frame = self.bounds;
// Position Calculation
NSInteger count = self.weekdayPointers.count;
size_t size = sizeof(CGFloat)*count;
CGFloat *widths = malloc(size);
CGFloat contentWidth = self.contentView.fs_width;
FSCalendarSliceCake(contentWidth, count, widths);
BOOL opposite = NO;
if (@available(iOS 9.0, *)) {
UIUserInterfaceLayoutDirection direction = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.calendar.semanticContentAttribute];
opposite = (direction == UIUserInterfaceLayoutDirectionRightToLeft);
}
CGFloat x = 0;
for (NSInteger i = 0; i < count; i++) {
CGFloat width = widths[i];
NSInteger labelIndex = opposite ? count-1-i : i;
UILabel *label = [self.weekdayPointers pointerAtIndex:labelIndex];
label.frame = CGRectMake(x, 0, width, self.contentView.fs_height);
x = CGRectGetMaxX(label.frame);
}
free(widths);
}
- (void)setCalendar:(FSCalendar *)calendar
{
_calendar = calendar;
[self configureAppearance];
}
- (NSArray<UILabel *> *)weekdayLabels
{
return self.weekdayPointers.allObjects;
}
- (void)configureAppearance
{
BOOL useVeryShortWeekdaySymbols = (self.calendar.appearance.caseOptions & (15<<4) ) == FSCalendarCaseOptionsWeekdayUsesSingleUpperCase;
NSArray *weekdaySymbols = useVeryShortWeekdaySymbols ? self.calendar.gregorian.veryShortStandaloneWeekdaySymbols : self.calendar.gregorian.shortStandaloneWeekdaySymbols;
BOOL useDefaultWeekdayCase = (self.calendar.appearance.caseOptions & (15<<4) ) == FSCalendarCaseOptionsWeekdayUsesDefaultCase;
for (NSInteger i = 0; i < self.weekdayPointers.count; i++) {
NSInteger index = (i + self.calendar.firstWeekday-1) % 7;
UILabel *label = [self.weekdayPointers pointerAtIndex:i];
label.font = self.calendar.appearance.weekdayFont;
label.textColor = self.calendar.appearance.weekdayTextColor;
label.text = useDefaultWeekdayCase ? weekdaySymbols[index] : [weekdaySymbols[index] uppercaseString];
}
}
@end
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>282</string>
<key>NSPrincipalClass</key>
<string></string>
<key>net.goout.GoOut.groupIdentifier</key>
<string>$(GROUP_IDENTIFIER)</string>
</dict>
</plist>
module FSCalendar {
header "FSCalendar.h"
header "FSCalendarAppearance.h"
header "FSCalendarCalculator.h"
header "FSCalendarCell.h"
header "FSCalendarCollectionView.h"
header "FSCalendarCollectionViewLayout.h"
header "FSCalendarConstants.h"
header "FSCalendarDelegationFactory.h"
header "FSCalendarDelegationProxy.h"
header "FSCalendarDynamicHeader.h"
header "FSCalendarExtensions.h"
header "FSCalendarHeaderView.h"
header "FSCalendarSeparatorDecorationView.h"
header "FSCalendarStickyHeader.h"
header "FSCalendarTransitionCoordinator.h"
header "FSCalendarWeekdayView.h"
export *
}
......@@ -8,32 +8,32 @@
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment