This repository has been archived by the owner on Aug 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
268 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Pod::Spec.new do |s| | ||
s.name = "Bohr" | ||
s.version = "3.0.0-alpha.1" | ||
s.version = "3.0.0-alpha.2" | ||
s.summary = "Settings screen composing framework" | ||
s.homepage = "https://github.com/DavdRoman/Bohr" | ||
s.author = { "David Román" => "[email protected]" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// BODateTableViewCell.h | ||
// Bohr | ||
// | ||
// Created by David Román Aguirre on 28/08/15. | ||
// | ||
// | ||
|
||
#import "BOTableViewCell.h" | ||
|
||
@interface BODateTableViewCell : BOTableViewCell | ||
|
||
@property (nonatomic, assign) NSString *dateFormat; | ||
@property (nonatomic) UIDatePicker *datePicker; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// BODateTableViewCell.m | ||
// Bohr | ||
// | ||
// Created by David Román Aguirre on 28/08/15. | ||
// | ||
// | ||
|
||
#import "BODateTableViewCell.h" | ||
|
||
#import "BOTableViewCell+Subclass.h" | ||
#import "UILabel+DatePickerCustomization.h" | ||
|
||
@interface BODateTableViewCell () | ||
|
||
@property (nonatomic) NSDateFormatter *dateFormatter; | ||
|
||
@end | ||
|
||
@implementation BODateTableViewCell | ||
|
||
- (void)setup { | ||
self.datePicker = [UIDatePicker new]; | ||
self.datePicker.backgroundColor = [UIColor clearColor]; | ||
self.datePicker.datePickerMode = UIDatePickerModeDate; | ||
[self.datePicker addTarget:self action:@selector(datePickerValueDidChange) forControlEvents:UIControlEventValueChanged]; | ||
self.expansionView = self.datePicker; | ||
|
||
self.dateFormatter = [NSDateFormatter new]; | ||
self.dateFormatter.dateFormat = [self defaultDateFormat]; | ||
} | ||
|
||
- (CGFloat)expansionHeight { | ||
// Uncomment if the picker view doesn't show on iOS 9. | ||
// return 216; | ||
return [super expansionHeight]; | ||
} | ||
|
||
- (void)setDateFormat:(NSString *)dateFormat { | ||
dateFormat = self.dateFormat.length == 0 ? [self defaultDateFormat] : dateFormat; | ||
self.dateFormatter.dateFormat = dateFormat; | ||
} | ||
|
||
- (NSString *)dateFormat { | ||
return self.dateFormatter.dateFormat; | ||
} | ||
|
||
- (NSString *)defaultDateFormat { | ||
return [NSDateFormatter dateFormatFromTemplate:@"dd/MM/YYYY" options:kNilOptions locale:[NSLocale currentLocale]]; | ||
} | ||
|
||
- (void)settingValueDidChange { | ||
self.detailTextLabel.text = [self.dateFormatter stringFromDate:self.setting.value]; | ||
self.datePicker.date = self.setting.value; | ||
} | ||
|
||
- (void)datePickerValueDidChange { | ||
self.setting.value = self.datePicker.date; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.