Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
|
|
@ -0,0 +1,54 @@
|
|||
#import "MWMOpeningHoursTimeSelectorTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursTimeSelectorTableViewCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIDatePicker * openTimePicker;
|
||||
@property (weak, nonatomic) IBOutlet UIDatePicker * closeTimePicker;
|
||||
|
||||
@property (nonatomic) NSCalendar * calendar;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMOpeningHoursTimeSelectorTableViewCell
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width
|
||||
{
|
||||
return 180.0;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
self.calendar = NSCalendar.currentCalendar;
|
||||
self.calendar.locale = NSLocale.currentLocale;
|
||||
}
|
||||
|
||||
- (void)refresh
|
||||
{
|
||||
[super refresh];
|
||||
MWMOpeningHoursSection * section = self.section;
|
||||
NSUInteger const row = section.selectedRow.unsignedIntegerValue;
|
||||
NSDate * openDate = [self.calendar dateFromComponents:[section timeForRow:row isStart:YES]];
|
||||
NSDate * closeDate = [self.calendar dateFromComponents:[section timeForRow:row isStart:NO]];
|
||||
|
||||
[self.openTimePicker setDate:openDate animated:NO];
|
||||
[self.closeTimePicker setDate:closeDate animated:NO];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)openValueChanged
|
||||
{
|
||||
NSDate * date = self.openTimePicker.date;
|
||||
NSCalendarUnit const components = NSCalendarUnitHour | NSCalendarUnitMinute;
|
||||
self.section.cachedStartTime = [self.calendar components:components fromDate:date];
|
||||
}
|
||||
|
||||
- (IBAction)closeValueChanged
|
||||
{
|
||||
NSDate * date = self.closeTimePicker.date;
|
||||
NSCalendarUnit const components = NSCalendarUnitHour | NSCalendarUnitMinute;
|
||||
self.section.cachedEndTime = [self.calendar components:components fromDate:date];
|
||||
}
|
||||
|
||||
@end
|
||||
Loading…
Add table
Add a link
Reference in a new issue