| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_i
tem.h" | 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_i
tem.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 7 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) | 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." | 10 #error "This file requires ARC support." |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 const CGFloat kImageSize = 100; | 14 const CGFloat kImageSize = 100; |
| 15 const CGFloat kStandardSpacing = 8; | 15 const CGFloat kStandardSpacing = 8; |
| 16 } | 16 } |
| 17 | 17 |
| 18 @interface ContentSuggestionsArticleItem () | 18 @interface ContentSuggestionsArticleItem () |
| 19 | 19 |
| 20 @property(nonatomic, copy) NSString* title; | |
| 21 @property(nonatomic, copy) NSString* subtitle; | 20 @property(nonatomic, copy) NSString* subtitle; |
| 22 | 21 |
| 23 @end | 22 @end |
| 24 | 23 |
| 25 #pragma mark - ContentSuggestionsArticleItem | 24 #pragma mark - ContentSuggestionsArticleItem |
| 26 | 25 |
| 27 @implementation ContentSuggestionsArticleItem | 26 @implementation ContentSuggestionsArticleItem |
| 28 | 27 |
| 29 @synthesize title = _title; | 28 @synthesize title = _title; |
| 30 @synthesize subtitle = _subtitle; | 29 @synthesize subtitle = _subtitle; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // changes, for instance on screen rotation. | 119 // changes, for instance on screen rotation. |
| 121 CGFloat parentWidth = CGRectGetWidth(self.contentView.bounds); | 120 CGFloat parentWidth = CGRectGetWidth(self.contentView.bounds); |
| 122 self.subtitleLabel.preferredMaxLayoutWidth = parentWidth - kImageSize - 3 * 8; | 121 self.subtitleLabel.preferredMaxLayoutWidth = parentWidth - kImageSize - 3 * 8; |
| 123 | 122 |
| 124 // Re-layout with the new preferred width to allow the label to adjust its | 123 // Re-layout with the new preferred width to allow the label to adjust its |
| 125 // height. | 124 // height. |
| 126 [super layoutSubviews]; | 125 [super layoutSubviews]; |
| 127 } | 126 } |
| 128 | 127 |
| 129 @end | 128 @end |
| OLD | NEW |