Files
comaps/iphone/Maps/UI/Editor/OpeningHours/Cells/MWMOpeningHoursTimeSpanTableViewCell.mm
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

51 lines
1.5 KiB
Plaintext

#import "MWMOpeningHoursTimeSpanTableViewCell.h"
@interface MWMOpeningHoursTimeSpanTableViewCell ()
@property (weak, nonatomic) IBOutlet UILabel * openTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel * closeTimeLabel;
@end
@implementation MWMOpeningHoursTimeSpanTableViewCell
+ (CGFloat)heightForWidth:(CGFloat)width
{
return 64.0;
}
- (void)refresh
{
[super refresh];
NSCalendar * calendar = NSCalendar.currentCalendar;
MWMOpeningHoursSection * section = self.section;
NSUInteger const row = self.row;
NSDate * openDate = [calendar dateFromComponents:[section timeForRow:row isStart:YES]];
NSDate * closeDate = [calendar dateFromComponents:[section timeForRow:row isStart:NO]];
NSDateFormatterStyle timeStyle = NSDateFormatterShortStyle;
NSDateFormatterStyle dateStyle = NSDateFormatterNoStyle;
self.openTimeLabel.text = [DateTimeFormatter dateStringFrom:openDate dateStyle:dateStyle timeStyle:timeStyle];
self.closeTimeLabel.text = [DateTimeFormatter dateStringFrom:closeDate dateStyle:dateStyle timeStyle:timeStyle];
UIColor * clr = [section isRowSelected:row] ? [UIColor linkBlue] : [UIColor blackSecondaryText];
self.openTimeLabel.textColor = clr;
self.closeTimeLabel.textColor = clr;
}
#pragma mark - Actions
- (IBAction)expandTap
{
if (self.isVisible)
{
MWMOpeningHoursSection * section = self.section;
NSUInteger const row = self.row;
section.selectedRow = [section isRowSelected:row] ? nil : @(row);
[section refresh:NO];
}
}
@end