Просмотр исходного кода

date pickers look and work pro

Kevin Bradley лет назад: 5
Родитель
Сommit
62cb0f164d

+ 19 - 1
Classes/Editing/FLEXFieldEditorViewController.m

@@ -76,6 +76,11 @@
     [_getterButton addTarget:self action:@selector(getterButtonPressed:) forControlEvents:UIControlEventPrimaryActionTriggered];
     [_getterButton addTarget:self action:@selector(getterButtonPressed:) forControlEvents:UIControlEventPrimaryActionTriggered];
     _getterButton.frame = CGRectMake(100, 600, 200, 60);
     _getterButton.frame = CGRectMake(100, 600, 200, 60);
     [self.view addSubview:_getterButton];
     [self.view addSubview:_getterButton];
+    UIFocusGuide *focusGuide = [[UIFocusGuide alloc] init];
+    [self.view addLayoutGuide:focusGuide];
+    [focusGuide.topAnchor constraintEqualToAnchor:self.actionButton.topAnchor].active = true;
+    [focusGuide.bottomAnchor constraintEqualToAnchor:self.getterButton.bottomAnchor].active = true;
+    focusGuide.preferredFocusEnvironments = @[self.actionButton, self.getterButton];
     #endif
     #endif
 
 
     // Configure input view
     // Configure input view
@@ -97,6 +102,19 @@
     }
     }
 }
 }
 
 
+- (NSArray *)preferredFocusEnvironments {
+    if ([self actionButton] && _getterButton){
+        return @[[self actionButton],_getterButton];
+    } else {
+        if ([self actionButton]){
+            return @[[self actionButton]];
+        } else if (_getterButton){
+            return @[_getterButton];
+        }
+    }
+    return nil;
+}
+
 - (void)actionButtonPressed:(id)sender {
 - (void)actionButtonPressed:(id)sender {
     if (self.property) {
     if (self.property) {
         id userInputObject = self.firstInputView.inputValue;
         id userInputObject = self.firstInputView.inputValue;
@@ -143,7 +161,7 @@
     
     
     FLEXArgumentInputView *inputView = [FLEXArgumentInputViewFactory argumentInputViewForTypeEncoding:self.typeEncoding];
     FLEXArgumentInputView *inputView = [FLEXArgumentInputViewFactory argumentInputViewForTypeEncoding:self.typeEncoding];
     if ([inputView isKindOfClass:[FLEXArgumentInputDateView class]]){
     if ([inputView isKindOfClass:[FLEXArgumentInputDateView class]]){
-        [self actionButton].frame = CGRectMake(100, 450, 200, 60);
+        [self actionButton].frame = CGRectMake(100, 400, 200, 60);
         return;
         return;
     }
     }
     
     

+ 4 - 0
FLEX.xcodeproj/project.pbxproj

@@ -17,6 +17,7 @@
 		224D49AB1C673AB5000EAB86 /* FLEXSQLiteDatabaseManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 224D49A71C673AB5000EAB86 /* FLEXSQLiteDatabaseManager.m */; };
 		224D49AB1C673AB5000EAB86 /* FLEXSQLiteDatabaseManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 224D49A71C673AB5000EAB86 /* FLEXSQLiteDatabaseManager.m */; };
 		2EF6B04D1D494BE50006BDA5 /* FLEXNetworkCurlLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EF6B04B1D494BE50006BDA5 /* FLEXNetworkCurlLogger.m */; };
 		2EF6B04D1D494BE50006BDA5 /* FLEXNetworkCurlLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EF6B04B1D494BE50006BDA5 /* FLEXNetworkCurlLogger.m */; };
 		2EF6B04E1D494BE50006BDA5 /* FLEXNetworkCurlLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EF6B04C1D494BE50006BDA5 /* FLEXNetworkCurlLogger.h */; };
 		2EF6B04E1D494BE50006BDA5 /* FLEXNetworkCurlLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EF6B04C1D494BE50006BDA5 /* FLEXNetworkCurlLogger.h */; };
+		323F6BC4259AF7430055BDD6 /* Macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 323F6BC3259AF7430055BDD6 /* Macros.h */; };
 		325D7AAF2593AE4700CC6B10 /* Cursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 325D7AAE2593AE4700CC6B10 /* Cursor.png */; };
 		325D7AAF2593AE4700CC6B10 /* Cursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 325D7AAE2593AE4700CC6B10 /* Cursor.png */; };
 		325D7AB32593F25B00CC6B10 /* UIWindow+FLEX.h in Headers */ = {isa = PBXBuildFile; fileRef = 325D7AB12593F25B00CC6B10 /* UIWindow+FLEX.h */; };
 		325D7AB32593F25B00CC6B10 /* UIWindow+FLEX.h in Headers */ = {isa = PBXBuildFile; fileRef = 325D7AB12593F25B00CC6B10 /* UIWindow+FLEX.h */; };
 		325D7AB42593F25B00CC6B10 /* UIWindow+FLEX.m in Sources */ = {isa = PBXBuildFile; fileRef = 325D7AB22593F25B00CC6B10 /* UIWindow+FLEX.m */; };
 		325D7AB42593F25B00CC6B10 /* UIWindow+FLEX.m in Sources */ = {isa = PBXBuildFile; fileRef = 325D7AB22593F25B00CC6B10 /* UIWindow+FLEX.m */; };
@@ -385,6 +386,7 @@
 		224D49A71C673AB5000EAB86 /* FLEXSQLiteDatabaseManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLEXSQLiteDatabaseManager.m; sourceTree = "<group>"; };
 		224D49A71C673AB5000EAB86 /* FLEXSQLiteDatabaseManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLEXSQLiteDatabaseManager.m; sourceTree = "<group>"; };
 		2EF6B04B1D494BE50006BDA5 /* FLEXNetworkCurlLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLEXNetworkCurlLogger.m; sourceTree = "<group>"; };
 		2EF6B04B1D494BE50006BDA5 /* FLEXNetworkCurlLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLEXNetworkCurlLogger.m; sourceTree = "<group>"; };
 		2EF6B04C1D494BE50006BDA5 /* FLEXNetworkCurlLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLEXNetworkCurlLogger.h; sourceTree = "<group>"; };
 		2EF6B04C1D494BE50006BDA5 /* FLEXNetworkCurlLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLEXNetworkCurlLogger.h; sourceTree = "<group>"; };
+		323F6BC3259AF7430055BDD6 /* Macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Macros.h; sourceTree = "<group>"; };
 		325D7AAE2593AE4700CC6B10 /* Cursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Cursor.png; sourceTree = SOURCE_ROOT; };
 		325D7AAE2593AE4700CC6B10 /* Cursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Cursor.png; sourceTree = SOURCE_ROOT; };
 		325D7AB12593F25B00CC6B10 /* UIWindow+FLEX.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIWindow+FLEX.h"; sourceTree = "<group>"; };
 		325D7AB12593F25B00CC6B10 /* UIWindow+FLEX.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIWindow+FLEX.h"; sourceTree = "<group>"; };
 		325D7AB22593F25B00CC6B10 /* UIWindow+FLEX.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIWindow+FLEX.m"; sourceTree = "<group>"; };
 		325D7AB22593F25B00CC6B10 /* UIWindow+FLEX.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIWindow+FLEX.m"; sourceTree = "<group>"; };
@@ -772,6 +774,7 @@
 		325D7AE025953F8D00CC6B10 /* tvOS */ = {
 		325D7AE025953F8D00CC6B10 /* tvOS */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
+				323F6BC3259AF7430055BDD6 /* Macros.h */,
 				325D7B0E25973F2E00CC6B10 /* postScript.sh */,
 				325D7B0E25973F2E00CC6B10 /* postScript.sh */,
 				32D4E15A259273E60027F238 /* fakes.h */,
 				32D4E15A259273E60027F238 /* fakes.h */,
 				32D4E15C2592749D0027F238 /* fakes.m */,
 				32D4E15C2592749D0027F238 /* fakes.m */,
@@ -1555,6 +1558,7 @@
 				3A4C94FF1B5B21410088C3F2 /* FLEXArgumentInputSwitchView.h in Headers */,
 				3A4C94FF1B5B21410088C3F2 /* FLEXArgumentInputSwitchView.h in Headers */,
 				C398625423AD6C67007E6793 /* FLEXRuntimeBrowserToolbar.h in Headers */,
 				C398625423AD6C67007E6793 /* FLEXRuntimeBrowserToolbar.h in Headers */,
 				3A4C94E71B5B21410088C3F2 /* FLEXHierarchyTableViewCell.h in Headers */,
 				3A4C94E71B5B21410088C3F2 /* FLEXHierarchyTableViewCell.h in Headers */,
+				323F6BC4259AF7430055BDD6 /* Macros.h in Headers */,
 				224D49AA1C673AB5000EAB86 /* FLEXSQLiteDatabaseManager.h in Headers */,
 				224D49AA1C673AB5000EAB86 /* FLEXSQLiteDatabaseManager.h in Headers */,
 				C386D6A9241995A800699085 /* FLEXTypeEncodingParser.h in Headers */,
 				C386D6A9241995A800699085 /* FLEXTypeEncodingParser.h in Headers */,
 				3A4C95031B5B21410088C3F2 /* FLEXArgumentInputView.h in Headers */,
 				3A4C95031B5B21410088C3F2 /* FLEXArgumentInputView.h in Headers */,

BIN
layout/Library/Frameworks/FLEX.framework/FLEX


+ 50 - 2
tvOS/KBDatePickerView.h

@@ -1,7 +1,55 @@
 #import <UIKit/UIKit.h>
 #import <UIKit/UIKit.h>
+#import "Macros.h"
+#define NUMBER_OF_CELLS 100000
 
 
-@interface KBDatePickerView: UIView <UITableViewDelegate, UITableViewDataSource>
-@property NSDate * _Nonnull date;
+@interface UIView (Helper)
+-(void)removeAllSubviews;
+@end
+
+@interface UIStackView (Helper)
+- (void)removeAllArrangedSubviews;
+- (void)setArrangedViews:(NSArray * _Nonnull )views;
+@end
+
+@interface KBTableView: UITableView
+@property NSIndexPath * _Nullable selectedIndexPath;
+@property id _Nullable selectedValue;
+- (id _Nullable )valueForIndexPath:(NSIndexPath *_Nonnull)indexPath;
+- (NSArray *_Nonnull)visibleValues;
+@end
+
+ // Enums are all defined like this to make it easier to convert them to / from string versions of themselves.
+ 
+#define TABLE_TAG(XX) \
+XX(KBTableViewTagMonths, = 501) \
+XX(KBTableViewTagDays, )\
+XX(KBTableViewTagYears, )\
+XX(KBTableViewTagHours, )\
+XX(KBTableViewTagMinutes, )\
+XX(KBTableViewTagAMPM, )\
+XX(KBTaleViewWeekday, )
+DECLARE_ENUM(KBTableViewTag, TABLE_TAG)
+
+#define PICKER_MODE(XX) \
+XX(KBDatePickerModeTime, ) \
+XX(KBDatePickerModeDate, ) \
+XX(KBDatePickerModeDateAndTime, ) \
+XX(KBDatePickerModeCountDownTimer, )
+DECLARE_ENUM(KBDatePickerMode, PICKER_MODE)
+
+@interface KBDatePickerView: UIControl <UITableViewDelegate, UITableViewDataSource>
+@property (nonnull, nonatomic, strong) NSDate *date;
+@property (nullable, nonatomic, strong) NSDate *minimumDate;
+@property (nullable, nonatomic, strong) NSDate *maximumDate;
 @property BOOL showDateLabel;
 @property BOOL showDateLabel;
+@property KBDatePickerMode datePickerMode;
+@property NSInteger topOffset;
 @property (nonatomic, copy, nullable) void (^itemSelectedBlock)(NSDate * _Nullable date);
 @property (nonatomic, copy, nullable) void (^itemSelectedBlock)(NSDate * _Nullable date);
++(id _Nonnull )todayInYear:(NSInteger)year;
++ (NSDateFormatter * _Nonnull )sharedDateFormatter;
 @end
 @end
+
+#define DLog(format, ...) CFShow((__bridge CFStringRef)[NSString stringWithFormat:format, ## __VA_ARGS__]);
+#define LOG_SELF        NSLog(@"[KBDatePickerView] %@ %@", self, NSStringFromSelector(_cmd))
+#define DPLog(format, ...) NSLog(@"[KBDatePickerView] %@",[NSString stringWithFormat:format, ## __VA_ARGS__]);
+#define DLOG_SELF DLog(@"%@ %@", self, NSStringFromSelector(_cmd))

Разница между файлами не показана из-за своего большого размера
+ 888 - 106
tvOS/KBDatePickerView.m


+ 7 - 0
tvOS/KBDatePickerView.og.h

@@ -0,0 +1,7 @@
+#import <UIKit/UIKit.h>
+
+@interface KBDatePickerView: UIView <UITableViewDelegate, UITableViewDataSource>
+@property NSDate * _Nonnull date;
+@property BOOL showDateLabel;
+@property (nonatomic, copy, nullable) void (^itemSelectedBlock)(NSDate * _Nullable date);
+@end

+ 212 - 0
tvOS/KBDatePickerView.og.m

@@ -0,0 +1,212 @@
+#import "KBDatePickerView.h"
+
+@interface KBDatePickerView () {
+    NSDate *_currentDate;
+}
+
+@property UIStackView *datePickerStackView;
+@property UITableView *monthTable;
+@property UITableView *dayTable;
+@property UITableView *yearTable;
+@property UILabel *monthLabel;
+@property UILabel *dayLabel;
+@property UILabel *yearLabel;
+@property UILabel *datePickerLabel;
+@end
+
+@implementation KBDatePickerView
+
+- (NSDate *)date {
+    if (!_currentDate){
+        [self setDate:[NSDate date]];
+    }
+    return _currentDate;
+}
+
+- (NSCalendar *)calendar {
+    return [NSCalendar currentCalendar];
+}
+
+- (void)setDate:(NSDate *)date {
+    _currentDate = date;
+    //_dateLabel.text = date.description;
+    [self scrollToCurrentDateAnimated:true];
+}
+
+
+- (id)init {
+    self = [super init];
+    if (![self date]){
+        [self setDate:[NSDate date]];
+    }
+    _showDateLabel = true;
+    [self layoutViews];
+    return self;
+}
+
+- (void)scrollToCurrentDateAnimated:(BOOL)animated {
+    NSDateComponents *components = [[self calendar] components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay fromDate:self.date];
+    [_monthTable selectRowAtIndexPath:[NSIndexPath indexPathForRow:components.month-1 inSection:0] animated:animated scrollPosition:UITableViewScrollPositionTop];
+    [_dayTable selectRowAtIndexPath:[NSIndexPath indexPathForRow:components.day-1 inSection:0] animated:animated scrollPosition:UITableViewScrollPositionTop];
+    [_yearTable selectRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0] animated:animated scrollPosition:UITableViewScrollPositionTop];
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    if (tableView == _monthTable){
+        return [self calendar].monthSymbols.count;
+    } else if (tableView == _dayTable){
+        NSRange days = [[self calendar] rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:self.date];
+        return days.length;
+    } else {
+        return 3;
+    }
+}
+
+- (void)tableView:(UITableView *)tableView didUpdateFocusInContext:(UITableViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
+    [coordinator addCoordinatedAnimations:^{
+         
+        NSIndexPath *ip = context.nextFocusedIndexPath;
+        NSLog(@"[KBDatePicker] next ip: %@", ip);
+        [tableView selectRowAtIndexPath:ip animated:false scrollPosition:UITableViewScrollPositionTop];
+          
+      } completion:^{
+          
+      }];
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    UITableViewCell *cell = nil;
+    if (tableView == _monthTable){
+        cell = [tableView dequeueReusableCellWithIdentifier:@"month"];
+        if (!cell){
+            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"month"];
+        }
+        cell.textLabel.text = [[self calendar] monthSymbols][indexPath.row];
+        cell.textLabel.textAlignment = NSTextAlignmentCenter;
+    } else if (tableView == _dayTable){
+        cell = [tableView dequeueReusableCellWithIdentifier:@"day"];
+        if (!cell){
+            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"day"];
+        }
+        cell.textLabel.text = [NSString stringWithFormat:@"%lu", indexPath.row + 1];
+        cell.textLabel.textAlignment = NSTextAlignmentCenter;
+    } else {
+        cell = [tableView dequeueReusableCellWithIdentifier:@"year"];
+        if (!cell){
+            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"year"];
+        }
+        NSInteger year = [[self calendar] component:NSCalendarUnitYear fromDate:self.date];
+        cell.textLabel.text = [NSString stringWithFormat:@"%lu", year - 1 + indexPath.row];
+        cell.textLabel.textAlignment = NSTextAlignmentCenter;
+    }
+    return cell;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    NSDateComponents *components = [[self calendar] components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay fromDate:self.date];
+    if (tableView == _monthTable){
+        NSInteger month = indexPath.row + 1;
+        components.month = month;
+        NSDate *newDate = nil;
+        do {
+            newDate = [[self calendar] dateFromComponents:components];
+            components.day -= 1;
+        } while (newDate == nil || ([[self calendar] component:NSCalendarUnitMonth fromDate:newDate] != month));
+        [self setDate:newDate];
+        [[self dayTable] reloadData];
+        [[self yearTable] reloadData];
+    } else if (tableView == _dayTable){
+        components.day = indexPath.row + 1;
+        NSDate *newDate = [[self calendar] dateFromComponents:components];
+        if (newDate){
+            [self setDate:newDate];
+            [[self monthTable] reloadData];
+            [[self yearTable] reloadData];
+        }
+    } else {
+        NSInteger year = [[self calendar] component:NSCalendarUnitYear fromDate:self.date];
+        components.year = year - 1 + indexPath.row;
+        NSDate *newDate = nil;
+        do {
+            newDate = [[self calendar] dateFromComponents:components];
+            components.day -= 1;
+        } while (newDate == nil || ([[self calendar] component:NSCalendarUnitMonth fromDate:newDate] != components.month));
+        [self setDate:newDate];
+        [[self monthTable] reloadData];
+        [[self yearTable] reloadData];
+    }
+    if (self.itemSelectedBlock){
+        self.itemSelectedBlock(self.date);
+    }
+    if (self.showDateLabel){
+        self.datePickerLabel.hidden = false;
+        self.datePickerLabel.text = self.date.description;
+    } else {
+        self.datePickerLabel.hidden = true;
+    }
+}
+
+- (CGSize)sizeThatFits:(CGSize)size {
+    //CGSize sup = [super sizeThatFits:size];
+    return CGSizeMake(720, 128+81+60+40);
+}
+
+- (void)layoutViews {
+    
+    self.monthLabel = [[UILabel alloc] init];
+    self.monthLabel.translatesAutoresizingMaskIntoConstraints = false;
+    self.monthLabel.text = @"Month";
+    self.yearLabel = [[UILabel alloc] init];
+    self.yearLabel.translatesAutoresizingMaskIntoConstraints = false;
+    self.yearLabel.text = @"Year";
+    self.dayLabel = [[UILabel alloc] init];
+    self.dayLabel.translatesAutoresizingMaskIntoConstraints = false;
+    self.dayLabel.text = @"Day";
+
+    self.monthTable = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
+    self.yearTable = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
+    self.dayTable = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
+    self.monthTable.delegate = self;
+    self.monthTable.dataSource = self;
+    self.yearTable.delegate = self;
+    self.yearTable.dataSource = self;
+    self.dayTable.delegate = self;
+    self.dayTable.dataSource = self;
+    
+    self.datePickerStackView = [[UIStackView alloc] initWithArrangedSubviews:@[self.monthTable, self.dayTable, self.yearTable]];
+    self.datePickerStackView.translatesAutoresizingMaskIntoConstraints = false;
+    self.datePickerStackView.spacing = 10;
+    self.datePickerStackView.axis = UILayoutConstraintAxisHorizontal;
+    self.datePickerStackView.alignment = UIStackViewAlignmentFill;
+    self.datePickerStackView.distribution = UIStackViewDistributionFillEqually;
+    [self.datePickerStackView.widthAnchor constraintEqualToConstant:720].active = true;
+    [self.datePickerStackView.heightAnchor constraintEqualToConstant:128].active = true;
+    
+    [self addSubview:self.datePickerStackView];
+    [self addSubview:self.monthLabel];
+    [self addSubview:self.yearLabel];
+    [self addSubview:self.dayLabel];
+
+    [self.datePickerStackView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor].active = true;
+    [self.datePickerStackView.topAnchor constraintEqualToAnchor:self.dayLabel.bottomAnchor constant:60].active = true;
+    [self.monthLabel.topAnchor constraintEqualToAnchor:self.topAnchor constant:20].active = true;
+    [self.dayLabel.topAnchor constraintEqualToAnchor:self.topAnchor constant:20].active = true;
+    [self.dayLabel.centerXAnchor constraintEqualToAnchor:self.dayTable.centerXAnchor].active = true;
+    [self.monthLabel.centerXAnchor constraintEqualToAnchor:self.monthTable.centerXAnchor].active = true;
+    [self.yearLabel.centerXAnchor constraintEqualToAnchor:self.yearTable.centerXAnchor].active = true;
+    [self.yearLabel.topAnchor constraintEqualToAnchor:self.topAnchor constant:20].active = true;
+    [self.monthLabel.topAnchor constraintEqualToAnchor:self.topAnchor constant:20].active = true;
+    
+    self.datePickerLabel = [[UILabel alloc] init];
+    self.datePickerLabel.translatesAutoresizingMaskIntoConstraints = false;
+    self.datePickerLabel.hidden = !_showDateLabel;
+    [self addSubview:self.datePickerLabel];
+    [self.datePickerLabel.centerXAnchor constraintEqualToAnchor:self.centerXAnchor].active = true;
+    [self.datePickerLabel.topAnchor constraintEqualToAnchor:self.datePickerStackView.bottomAnchor constant:80].active = true;
+    
+    
+}
+
+@end