| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 6 #error "This file requires ARC support." |
| 7 #endif |
| 8 |
| 9 #import "remoting/ios/app/host_collection_header_view.h" |
| 10 |
| 11 #import <UIKit/UIKit.h> |
| 12 |
| 13 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 14 |
| 15 // Applied on the left and right of the label. |
| 16 static const float kTitleMargin = 12.f; |
| 17 |
| 18 @interface HostCollectionHeaderView () { |
| 19 @private |
| 20 UILabel* _titleLabel; |
| 21 } |
| 22 @end |
| 23 |
| 24 @implementation HostCollectionHeaderView |
| 25 |
| 26 - (instancetype)initWithFrame:(CGRect)frame { |
| 27 self = [super initWithFrame:frame]; |
| 28 if (self) { |
| 29 _titleLabel = [[UILabel alloc] init]; |
| 30 _titleLabel.font = [MDCTypography body2Font]; |
| 31 _titleLabel.textColor = [UIColor whiteColor]; |
| 32 _titleLabel.backgroundColor = [UIColor clearColor]; |
| 33 _titleLabel.translatesAutoresizingMaskIntoConstraints = NO; |
| 34 [self addSubview:_titleLabel]; |
| 35 |
| 36 [NSLayoutConstraint activateConstraints:@[ |
| 37 [[_titleLabel leadingAnchor] constraintEqualToAnchor:[self leadingAnchor] |
| 38 constant:kTitleMargin], |
| 39 [[_titleLabel centerYAnchor] |
| 40 constraintEqualToAnchor:[self centerYAnchor]], |
| 41 [[_titleLabel trailingAnchor] |
| 42 constraintEqualToAnchor:[self trailingAnchor] |
| 43 constant:-kTitleMargin], |
| 44 ]]; |
| 45 } |
| 46 return self; |
| 47 } |
| 48 |
| 49 - (NSString*)text { |
| 50 return _titleLabel.text; |
| 51 } |
| 52 |
| 53 - (void)setText:(NSString*)text { |
| 54 _titleLabel.text = text; |
| 55 } |
| 56 |
| 57 @end |
| OLD | NEW |