Adrian Secord 2997e50c4c Updated refs to GitHub repo with new location. (#885)
* Updated refs to GitHub repo with new location.

* Reverted chagnes to JSON files.
2016-11-22 14:32:50 -05:00

65 lines
2.4 KiB
Objective-C

/*
Copyright 2015-present the Material Components for iOS authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import <UIKit/UIKit.h>
#import "MaterialFontDiskLoader.h"
#import "MaterialRobotoFontLoader.h"
// TODO(iangordon): Re-add 'private/' to the path below once our Podspec specfically defines our
// header search paths instead of flattening our header files into a single directory.
#import "MDCRoboto+Constants.h"
@interface FontDiskLoaderSimpleExample : UIViewController
@end
@implementation FontDiskLoaderSimpleExample
// TODO: Support other categorizational methods.
+ (NSArray *)catalogBreadcrumbs {
return @[ @"Typography and Fonts", @"Font Disk Loader" ];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
UIViewAutoresizing flexibleMargins =
UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin |
UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
// Consider using the named styles provided by the Typography component instead of specific font
// sizes. See https://github.com/material-components/material-components-ios/tree/develop/components/Typography
NSBundle *bundle = [NSBundle bundleForClass:[MDCRobotoFontLoader class]];
MDCFontDiskLoader *fontDiskLoader =
[[MDCFontDiskLoader alloc] initWithFontName:MDCRobotoRegularFontName
filename:MDCRobotoRegularFontFilename
bundleFileName:MDCRobotoBundle
baseBundle:bundle];
UILabel *label = [[UILabel alloc] init];
label.text = @"This is Roboto regular 16";
label.font = [fontDiskLoader fontOfSize:16];
[label sizeToFit];
label.autoresizingMask = flexibleMargins;
label.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds));
[self.view addSubview:label];
}
#pragma mark - Private
@end