From d130df2d805f51c7602fa748b58fe56b19785f56 Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Thu, 28 Apr 2016 15:27:57 +0300 Subject: [PATCH] [ios] Fixed different table section header views in downloader. --- .../Cells/MWMMapDownloaderCellHeader.h | 3 +++ .../Cells/MWMMapDownloaderCellHeader.mm | 23 +++++++++++++++++++ .../MWMBaseMapDownloaderViewController.mm | 11 +++++++++ iphone/Maps/Maps.xcodeproj/project.pbxproj | 8 +++++++ 4 files changed, 45 insertions(+) create mode 100644 iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderCellHeader.h create mode 100644 iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderCellHeader.mm diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderCellHeader.h b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderCellHeader.h new file mode 100644 index 0000000000..b39ce03ebb --- /dev/null +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderCellHeader.h @@ -0,0 +1,3 @@ +@interface MWMMapDownloaderCellHeader : UILabel + +@end diff --git a/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderCellHeader.mm b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderCellHeader.mm new file mode 100644 index 0000000000..535210134f --- /dev/null +++ b/iphone/Maps/Classes/MapDownloader/Cells/MWMMapDownloaderCellHeader.mm @@ -0,0 +1,23 @@ +#import "MWMMapDownloaderCellHeader.h" +#import "UIColor+MapsMeColor.h" +#import "UIFont+MapsMeFonts.h" + +@implementation MWMMapDownloaderCellHeader + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) + { + self.font = [UIFont regular12]; + self.textColor = [UIColor blackSecondaryText]; + } + return self; +} + +- (void)drawTextInRect:(CGRect)rect +{ + [super drawTextInRect:UIEdgeInsetsInsetRect(rect, {.left = 16})]; +} + +@end diff --git a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm index 1f1ea2ab61..50d0c4be96 100644 --- a/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm +++ b/iphone/Maps/Classes/MapDownloader/MWMBaseMapDownloaderViewController.mm @@ -3,6 +3,7 @@ #import "MWMAlertViewController.h" #import "MWMButton.h" #import "MWMFrameworkListener.h" +#import "MWMMapDownloaderCellHeader.h" #import "MWMMapDownloaderDefaultDataSource.h" #import "MWMMapDownloaderLargeCountryTableViewCell.h" #import "MWMMapDownloaderPlaceTableViewCell.h" @@ -466,6 +467,16 @@ using namespace mwm; return 0.0; } +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section +{ + CGFloat const width = CGRectGetWidth(tableView.bounds); + CGFloat const height = [self tableView:tableView heightForHeaderInSection:section]; + MWMMapDownloaderCellHeader * headerView = + [[MWMMapDownloaderCellHeader alloc] initWithFrame:{{}, {width, height}}]; + headerView.text = [self.dataSource tableView:tableView titleForHeaderInSection:section]; + return headerView; +} + #pragma mark - UILongPressGestureRecognizer - (IBAction)longPress:(UILongPressGestureRecognizer *)sender diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index c70fb58662..dcf9fd8ea9 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -260,6 +260,8 @@ 34D15BA91BD8F93C00C8BCBE /* AddSetTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34D15BA71BD8F93C00C8BCBE /* AddSetTableViewCell.xib */; }; 34D349FB1CD0A3EE00895216 /* MWMWhatsNewEditorController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34D349FA1CD0A3EE00895216 /* MWMWhatsNewEditorController.mm */; }; 34D349FC1CD0A3EE00895216 /* MWMWhatsNewEditorController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34D349FA1CD0A3EE00895216 /* MWMWhatsNewEditorController.mm */; }; + 34D37E171CD2373C001DEFC3 /* MWMMapDownloaderCellHeader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34D37E161CD2373C001DEFC3 /* MWMMapDownloaderCellHeader.mm */; }; + 34D37E181CD2373C001DEFC3 /* MWMMapDownloaderCellHeader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34D37E161CD2373C001DEFC3 /* MWMMapDownloaderCellHeader.mm */; }; 34DCDE3A1C75CD8100652CAC /* Framework.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34479C751C60C6130065D261 /* Framework.cpp */; }; 34DCDE3B1C75CE1F00652CAC /* MWMOpeningHoursDeleteScheduleTableViewCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 347FD85A1C60B2CE002FB65E /* MWMOpeningHoursDeleteScheduleTableViewCell.mm */; }; 34DDD5341BFDB0B600407F2F /* MWMMapDownloaderViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 342AF0DF1BE24E9A0016F3AE /* MWMMapDownloaderViewController.mm */; }; @@ -1149,6 +1151,8 @@ 34D15BA71BD8F93C00C8BCBE /* AddSetTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AddSetTableViewCell.xib; sourceTree = ""; }; 34D349F91CD0A3EE00895216 /* MWMWhatsNewEditorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MWMWhatsNewEditorController.h; path = Welcome/MWMWhatsNewEditorController.h; sourceTree = ""; }; 34D349FA1CD0A3EE00895216 /* MWMWhatsNewEditorController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MWMWhatsNewEditorController.mm; path = Welcome/MWMWhatsNewEditorController.mm; sourceTree = ""; }; + 34D37E151CD2373C001DEFC3 /* MWMMapDownloaderCellHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMMapDownloaderCellHeader.h; sourceTree = ""; }; + 34D37E161CD2373C001DEFC3 /* MWMMapDownloaderCellHeader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMMapDownloaderCellHeader.mm; sourceTree = ""; }; 34DCDE3D1C76195F00652CAC /* MWMMapDownloaderProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMMapDownloaderProtocol.h; sourceTree = ""; }; 34E0EECA1CC4F36B008E4919 /* MWMMapDownloaderTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMMapDownloaderTypes.h; sourceTree = ""; }; 34E0EECB1CC51B1D008E4919 /* MWMMapDownloaderButtonTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMMapDownloaderButtonTableViewCell.h; sourceTree = ""; }; @@ -1906,6 +1910,8 @@ 341F99C81C6B1165001C67B8 /* Cells */ = { isa = PBXGroup; children = ( + 34D37E151CD2373C001DEFC3 /* MWMMapDownloaderCellHeader.h */, + 34D37E161CD2373C001DEFC3 /* MWMMapDownloaderCellHeader.mm */, 34E0EED21CC51B70008E4919 /* MWMMapDownloaderTableViewCellProtocol.h */, 341F99C91C6B1165001C67B8 /* MWMMapDownloaderLargeCountryTableViewCell.h */, 341F99CA1C6B1165001C67B8 /* MWMMapDownloaderLargeCountryTableViewCell.mm */, @@ -3607,6 +3613,7 @@ 3438CDFC1B862F5C0051AA78 /* MWMSearchContentView.mm in Sources */, 34479C7C1C60C6130065D261 /* MWMFrameworkListener.mm in Sources */, 3485C0121B85C20E00F7712D /* MWMSearchTableViewController.mm in Sources */, + 34D37E171CD2373C001DEFC3 /* MWMMapDownloaderCellHeader.mm in Sources */, F64D9C9F1C899C350063FA30 /* MWMEditorViralAlert.mm in Sources */, 34CFFE8B1B7DE6FD009D0C9F /* MWMSearchManager.mm in Sources */, 34ABA62C1C2D57D500FE1BEC /* MWMInputPasswordValidator.mm in Sources */, @@ -3824,6 +3831,7 @@ 34DDD5351BFDB0C600407F2F /* MWMBaseMapDownloaderViewController.mm in Sources */, 6741A9CE1BF340DE002C974C /* MWMSearchManager.mm in Sources */, F64D9CA01C899C350063FA30 /* MWMEditorViralAlert.mm in Sources */, + 34D37E181CD2373C001DEFC3 /* MWMMapDownloaderCellHeader.mm in Sources */, 6741A9CF1BF340DE002C974C /* MWMLocationAlert.mm in Sources */, 34ABA62D1C2D57D500FE1BEC /* MWMInputPasswordValidator.mm in Sources */, 34ABA6171C2D185C00FE1BEC /* MWMAuthorizationOSMLoginViewController.mm in Sources */,