[ios] Added fonts grid.

This commit is contained in:
Ilya Grechuhin 2015-07-08 15:58:39 +03:00 committed by Alex Zolotarev
parent 26ddfd6da7
commit fe526c1325
19 changed files with 194 additions and 44 deletions

View file

@ -1,5 +1,6 @@
#import "RichTextVC.h"
#import "UIFont+MapsMeFonts.h"
@interface RichTextVC ()
@ -36,7 +37,7 @@
_textView.editable = NO;
if ([_textView respondsToSelector:@selector(setTextContainerInset:)])
_textView.textContainerInset = UIEdgeInsetsMake(10, 5, 10, 5);
_textView.font = [UIFont fontWithName:@"HelveticaNeue" size:16];
_textView.font = [UIFont regular16];
_textView.dataDetectorTypes = UIDataDetectorTypeLink;
}
return _textView;

View file

@ -1,6 +1,7 @@
#import "BadgeView.h"
#import "UIKitCategories.h"
#import "UIFont+MapsMeFonts.h"
@implementation BadgeView
@ -9,7 +10,7 @@
[self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
self.hidden = value == 0;
UIFont * font = [UIFont fontWithName:@"HelveticaNeue-Light" size:12];
UIFont * font = [UIFont regular10];
UIImage * image = [UIImage imageNamed:@"Badge"];
CGFloat const textWidth = [@(value).stringValue sizeWithDrawSize:CGSizeMake(100, 20) font:font].width;
CGFloat const offset = 4;

View file

@ -8,6 +8,7 @@
#import "MWMDirectionView.h"
#import "MWMPlacePageViewManager.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
static NSString * const kDirectionViewNibName = @"MWMDirectionView";
@ -37,7 +38,7 @@ static CGFloat const kDirectionArrowSide = IPAD ? 260. : 160.;
NSString * const kFontName = @"HelveticaNeue";
self.titleLabel.font = self.distanceLabel.font = IPAD ? [UIFont fontWithName:kFontName size:52.] : [UIFont fontWithName:kFontName size:32.];
self.typeLabel.font = IPAD ? [UIFont fontWithName:kFontName size:24.] : [UIFont fontWithName:kFontName size:16.];
self.typeLabel.font = IPAD ? [UIFont regular24] : [UIFont regular16];
self.autoresizingMask = self.contentView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
self.directionArrow.autoresizingMask = UIViewAutoresizingNone;

View file

@ -6,12 +6,13 @@
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import "MWMPlacePageInfoCell.h"
#import "UIKitCategories.h"
#import "MWMPlacePageEntity.h"
#import "MWMPlacePageInfoCell.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
#include "../../../platform/settings.hpp"
#include "../../../platform/measurement_utils.hpp"
#include "platform/settings.hpp"
#include "platform/measurement_utils.hpp"
extern NSString * const kUserDefaultsLatLonAsDMSKey;
@ -64,7 +65,7 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey;
self.icon.image = image;
if ([self.textContainer isKindOfClass:[UITextView class]])
[self.textContainer setAttributedText:[[NSAttributedString alloc] initWithString:info attributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Light" size:16.]}]];
[self.textContainer setAttributedText:[[NSAttributedString alloc] initWithString:info attributes:@{NSFontAttributeName : [UIFont light16]}]];
else
[self.textContainer setText:info];

View file

@ -1,6 +1,8 @@
#import "Common.h"
#import "MapCell.h"
#import "UIKitCategories.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
@interface MapCell () <ProgressViewDelegate>
@ -267,7 +269,7 @@
_titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.textColor = [UIColor blackColor];
_titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:17];
_titleLabel.font = [UIFont regular17];
}
return _titleLabel;
}
@ -278,7 +280,7 @@
{
_subtitleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_subtitleLabel.backgroundColor = [UIColor clearColor];
_subtitleLabel.textColor = [UIColor colorWithColorCode:@"999999"];
_subtitleLabel.textColor = [UIColor blackSecondaryText];
_subtitleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:13];
}
return _subtitleLabel;

View file

@ -10,6 +10,7 @@
#import "RouteState.h"
#import "RouteView.h"
#import "ShareActionSheet.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
#import "UIViewController+Navigation.h"
@ -833,7 +834,7 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
[clearButton setTitle:L(@"clear") forState:UIControlStateNormal];
[clearButton addTarget:self action:@selector(clearApiMode:) forControlEvents:UIControlEventTouchUpInside];
clearButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
clearButton.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:17];
clearButton.titleLabel.font = [UIFont light17];
[_apiBar addSubview:clearButton];
[_apiBar addSubview:self.apiTitleLabel];
@ -853,7 +854,7 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
if (!_apiTitleLabel)
{
_apiTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 240, 26)];
_apiTitleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:17];
_apiTitleLabel.font = [UIFont light17];
_apiTitleLabel.textColor = [UIColor whiteColor];
_apiTitleLabel.textAlignment = NSTextAlignmentCenter;
_apiTitleLabel.alpha = 0.5;

View file

@ -7,6 +7,7 @@
//
#import "NextTurnPhoneView.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
@implementation NextTurnPhoneView
@ -129,7 +130,7 @@
{
_metricsLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_metricsLabel.backgroundColor = [UIColor clearColor];
_metricsLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:14];
_metricsLabel.font = [UIFont regular14];
_metricsLabel.textColor = [UIColor colorWithColorCode:@"2291D1"];
}
return _metricsLabel;

View file

@ -7,8 +7,9 @@
//
#import "RouteOverallInfoView.h"
#import "UIKitCategories.h"
#import "TimeUtils.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
@implementation RouteOverallInfoView
@ -81,7 +82,7 @@
{
_timeLeftLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_timeLeftLabel.backgroundColor = [UIColor clearColor];
_timeLeftLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:14];
_timeLeftLabel.font = [UIFont regular14];
_timeLeftLabel.textColor = [UIColor colorWithColorCode:@"565656"];
}
return _timeLeftLabel;

View file

@ -1,9 +1,9 @@
#import "SearchBar.h"
#import "Framework.h"
#import "SearchBar.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
#import "../../../3party/Alohalytics/src/alohalytics_objc.h"
#import "3party/Alohalytics/src/alohalytics_objc.h"
@interface SearchBar ()
@ -125,7 +125,7 @@ extern NSString * const kAlohalyticsTapEventKey;
{
_textField = [[UITextField alloc] initWithFrame:CGRectMake(1, 0, self.width, 22)];
_textField.autoresizingMask = UIViewAutoresizingFlexibleWidth;
_textField.font = [UIFont fontWithName:@"HelveticaNeue" size:16.];
_textField.font = [UIFont regular16];
_textField.textColor = [UIColor blackPrimaryText];
_textField.placeholder = L(@"search");
_textField.returnKeyType = UIReturnKeySearch;

View file

@ -1,7 +1,8 @@
#import "SearchCategoryCell.h"
#import "UIKitCategories.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
@interface SearchCategoryCell ()
@ -49,7 +50,7 @@
_titleLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.textColor = [UIColor blackPrimaryText];
_titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:16.];
_titleLabel.font = [UIFont regular16];
}
return _titleLabel;
}

View file

@ -1,7 +1,8 @@
#import "SearchResultCell.h"
#import "UIKitCategories.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
static CGFloat const kOffset = 16.;
@ -28,11 +29,11 @@ static CGFloat const kOffset = 16.;
return self;
}
#define DISTANCE_FONT [UIFont fontWithName:@"HelveticaNeue" size:14]
#define TYPE_FONT [UIFont fontWithName:@"HelveticaNeue-Light" size:12]
#define TITLE_FONT [UIFont fontWithName:@"HelveticaNeue" size:16]
#define TITLE_BOLD_FONT [UIFont fontWithName:@"HelveticaNeue-Bold" size:16]
#define SUBTITLE_FONT [UIFont fontWithName:@"HelveticaNeue-Light" size:12]
#define DISTANCE_FONT [UIFont regular14]
#define TYPE_FONT [UIFont light12]
#define TITLE_FONT [UIFont regular16]
#define TITLE_BOLD_FONT [UIFont bold16]
#define SUBTITLE_FONT [UIFont light12]
#define SPACE 4
- (void)setTitle:(NSString *)title selectedRanges:(NSArray *)selectedRanges

View file

@ -1,7 +1,8 @@
#import "SearchShowOnMapCell.h"
#import "UIKitCategories.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
static CGFloat const kOffset = 16.;
@ -45,7 +46,7 @@ static CGFloat const kOffset = 16.;
_titleLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.textColor = [UIColor primary];
_titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:16.];
_titleLabel.font = [UIFont regular16];
}
return _titleLabel;
}

View file

@ -1,7 +1,8 @@
#import "SearchSuggestCell.h"
#import "UIKitCategories.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
@interface SearchSuggestCell ()
@ -49,7 +50,7 @@
_titleLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.textColor = [UIColor primary];
_titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:16.];
_titleLabel.font = [UIFont regular16];
}
return _titleLabel;
}

View file

@ -1,4 +1,5 @@
#import "Common.h"
#import "Framework.h"
#import "LocationManager.h"
#import "LocationManager.h"
#import "MapsAppDelegate.h"
@ -11,22 +12,21 @@
#import "SearchView.h"
#import "Statistics.h"
#import "ToastView.h"
#import "UIKitCategories.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
#include "Framework.h"
#include "geometry/angles.hpp"
#include "geometry/distance_on_sphere.hpp"
#include "../../search/result.hpp"
#include "../../search/params.hpp"
#include "indexer/mercator.hpp"
#include "../../indexer/mercator.hpp"
#include "platform/platform.hpp"
#include "platform/preferred_languages.hpp"
#include "platform/settings.hpp"
#include "../../platform/platform.hpp"
#include "../../platform/preferred_languages.hpp"
#include "../../platform/settings.hpp"
#include "../../geometry/angles.hpp"
#include "../../geometry/distance_on_sphere.hpp"
#include "search/params.hpp"
#include "search/result.hpp"
@interface SearchResultsWrapper : NSObject
@ -779,7 +779,7 @@ static BOOL keyboardLoaded = NO;
{
_emptyResultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.width, 60)];
_emptyResultLabel.backgroundColor = [UIColor clearColor];
_emptyResultLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:16];
_emptyResultLabel.font = [UIFont regular16];
_emptyResultLabel.text = L(@"no_search_results_found");
_emptyResultLabel.textColor = [UIColor primary];
_emptyResultLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;

View file

@ -34,6 +34,7 @@
347274771B0F4F3900756B37 /* me.maps.watchkitextension.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 347274761B0F4F3900756B37 /* me.maps.watchkitextension.entitlements */; };
347274791B0F4FD900756B37 /* me.maps.watchkitextension.production.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 347274781B0F4FD900756B37 /* me.maps.watchkitextension.production.entitlements */; };
3472747B1B0F4FF100756B37 /* me.maps.production.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 3472747A1B0F4FF100756B37 /* me.maps.production.entitlements */; };
3472EC051B4D44BE0085CB79 /* UIFont+MapsMeFonts.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3472EC041B4D44BE0085CB79 /* UIFont+MapsMeFonts.mm */; };
348E578E1B0F3752000FA02A /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEB7E22111E9079400080A68 /* CoreLocation.framework */; };
34A742FE1AE5461A00CE15EB /* index.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34A742FD1AE5461A00CE15EB /* index.cpp */; };
34A743001AE5468200CE15EB /* storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34A742FF1AE5468200CE15EB /* storage.cpp */; };
@ -368,6 +369,8 @@
347274761B0F4F3900756B37 /* me.maps.watchkitextension.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = me.maps.watchkitextension.entitlements; sourceTree = "<group>"; };
347274781B0F4FD900756B37 /* me.maps.watchkitextension.production.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = me.maps.watchkitextension.production.entitlements; sourceTree = "<group>"; };
3472747A1B0F4FF100756B37 /* me.maps.production.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = me.maps.production.entitlements; sourceTree = "<group>"; };
3472EC031B4D44BE0085CB79 /* UIFont+MapsMeFonts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIFont+MapsMeFonts.h"; sourceTree = "<group>"; };
3472EC041B4D44BE0085CB79 /* UIFont+MapsMeFonts.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIFont+MapsMeFonts.mm"; sourceTree = "<group>"; };
348E57981B0F49D8000FA02A /* maps.me dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "maps.me dbg.app"; sourceTree = BUILT_PRODUCTS_DIR; };
348E57C81B0F49EE000FA02A /* maps.me WatchKit Extension WatchKit Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "maps.me WatchKit Extension WatchKit Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
348E57D71B0F49EE000FA02A /* maps.me WatchKit App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "maps.me WatchKit App.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -1148,6 +1151,8 @@
F62404FA1AAF3DB200B58DB6 /* UILabel+RuntimeAttributes.mm */,
F6F533A11B3C248900C1940B /* UIColor+MapsMeColor.h */,
F6F533A21B3C248900C1940B /* UIColor+MapsMeColor.mm */,
3472EC031B4D44BE0085CB79 /* UIFont+MapsMeFonts.h */,
3472EC041B4D44BE0085CB79 /* UIFont+MapsMeFonts.mm */,
);
name = Categories;
sourceTree = "<group>";
@ -2191,6 +2196,7 @@
97F61794183E7445009919E2 /* LinkCell.m in Sources */,
976D86EC19C8697700C920EF /* ProgressView.m in Sources */,
B0FBFA271A515AFD0086819E /* ViewController.m in Sources */,
3472EC051B4D44BE0085CB79 /* UIFont+MapsMeFonts.mm in Sources */,
F63732961AE9431E00A03764 /* MWMBasePlacePageView.mm in Sources */,
97A8001018B21395000C07A2 /* SearchBar.mm in Sources */,
EDC5C543175F2CA600420E92 /* ShareActionSheet.mm in Sources */,

View file

@ -1,5 +1,5 @@
//
// MWMPlacePage+MapsMeColor.h
// UIColor+MapsMeColor.h
// Maps
//
// Created by v.mikhaylenko on 25.06.15.

View file

@ -0,0 +1,26 @@
//
// UIFont+MapsMeFonts.h
// Maps
//
// Created by Ilya Grechuhin on 08.07.15.
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIFont (MapsMeFonts)
+ (UIFont *)regular10;
+ (UIFont *)regular14;
+ (UIFont *)regular16;
+ (UIFont *)regular17;
+ (UIFont *)regular18;
+ (UIFont *)regular24;
+ (UIFont *)light10;
+ (UIFont *)light12;
+ (UIFont *)light16;
+ (UIFont *)light17;
+ (UIFont *)bold16;
+ (UIFont *)bold48;
@end

View file

@ -0,0 +1,73 @@
//
// UIFont+MapsMeFonts.m
// Maps
//
// Created by Ilya Grechuhin on 08.07.15.
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import "UIFont+MapsMeFonts.h"
@implementation UIFont (MapsMeFonts)
+ (UIFont *)regular10
{
return [UIFont fontWithName:@"HelveticaNeue" size:10];
}
+ (UIFont *)regular14
{
return [UIFont fontWithName:@"HelveticaNeue" size:14];
}
+ (UIFont *)regular16
{
return [UIFont fontWithName:@"HelveticaNeue" size:16];
}
+ (UIFont *)regular17
{
return [UIFont fontWithName:@"HelveticaNeue" size:17];
}
+ (UIFont *)regular18
{
return [UIFont fontWithName:@"HelveticaNeue" size:18];
}
+ (UIFont *)regular24
{
return [UIFont fontWithName:@"HelveticaNeue" size:24];
}
+ (UIFont *)light10
{
return [UIFont fontWithName:@"HelveticaNeue-Light" size:10];
}
+ (UIFont *)light12
{
return [UIFont fontWithName:@"HelveticaNeue-Light" size:12];
}
+ (UIFont *)light16
{
return [UIFont fontWithName:@"HelveticaNeue-Light" size:16];
}
+ (UIFont *)light17
{
return [UIFont fontWithName:@"HelveticaNeue-Light" size:17];
}
+ (UIFont *)bold16
{
return [UIFont fontWithName:@"HelveticaNeue-Bold" size:16];
}
+ (UIFont *)bold48
{
return [UIFont fontWithName:@"HelveticaNeue-Bold" size:48];
}
@end

View file

@ -21,6 +21,14 @@
return L(self.text);
}
- (void)setFontName:(NSString *)fontName
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
self.font = [[UIFont class] performSelector:NSSelectorFromString(fontName)];
#pragma clang diagnostic pop
}
@end
@implementation UIButton (RuntimeAttributes)
@ -33,6 +41,14 @@
return L([self titleForState:UIControlStateNormal]);
}
- (void)setFontName:(NSString *)fontName
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
self.titleLabel.font = [[UIFont class] performSelector:NSSelectorFromString(fontName)];
#pragma clang diagnostic pop
}
@end
@implementation UITextField (RuntimeAttributes)
@ -47,6 +63,14 @@
return L(self.placeholder);
}
- (void)setFontName:(NSString *)fontName
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
self.font = [[UIFont class] performSelector:NSSelectorFromString(fontName)];
#pragma clang diagnostic pop
}
@end
@implementation MWMTextView (RuntimeAttributes)
@ -61,4 +85,12 @@
return L(self.placeholder);
}
- (void)setFontName:(NSString *)fontName
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
self.font = [[UIFont class] performSelector:NSSelectorFromString(fontName)];
#pragma clang diagnostic pop
}
@end