material-components_materia.../components/RobotoFontLoader/examples/RobotoFontLoaderSimpleExampleViewController.m
randallli 6f4f2dff21 [Typogarphy] Set font loader example
Reviewers: ajsecord, #mdc_ios_owners

Reviewed By: ajsecord, #mdc_ios_owners

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D502
2016-04-07 12:15:47 -04:00

47 lines
1.7 KiB
Objective-C

/*
Copyright 2015-present Google Inc. 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 "RobotoFontLoaderSimpleExampleViewController.h"
#import "MaterialRobotoFontLoader.h"
@implementation RobotoFontLoaderSimpleExampleViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
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/google/material-components-ios/tree/develop/components/Typography
UILabel *label = [[UILabel alloc] init];
label.text = @"This is Roboto regular 16";
label.font = [[MDCRobotoFontLoader sharedInstance] regularFontOfSize:16];
[label sizeToFit];
label.autoresizingMask = flexibleMargins;
label.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds));
[self.view addSubview:label];
}
+ (NSArray *)catalogBreadcrumbs {
return @[ @"RobotoFontLoader", @"Readme demo" ];
}
@end