OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 #ifndef IOS_CHROME_BROWSER_UI_FADE_TRUNCATED_LABEL_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_FADE_TRUNCATED_LABEL_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 // A label class that applies a gradient fade to the end of a label whose bounds |
| 11 // are too small to draw the entire string. This class uses a CAGradientLayer |
| 12 // as a mask instead of clipping the drawing context of the label. |
| 13 @interface FadeTruncatedLabel : UILabel |
| 14 |
| 15 // Returns a CAGadientLayer to use as a label's masking layer that will apply |
| 16 // a fade truncation if |text| takes up more space than |bounds| when drawn |
| 17 // with |attributes|. |
| 18 + (CAGradientLayer*)maskLayerForText:(NSString*)text |
| 19 withAttributes:(NSDictionary*)attributes |
| 20 inBounds:(CGRect)bounds; |
| 21 |
| 22 // Adds animations from |beginFrame| to |endFrame| using the provided |duration| |
| 23 // and |timingFunction|. |
| 24 - (void)animateFromBeginFrame:(CGRect)beginFrame |
| 25 toEndFrame:(CGRect)endFrame |
| 26 duration:(CFTimeInterval)duration |
| 27 timingFunction:(CAMediaTimingFunction*)timingFunction; |
| 28 |
| 29 // Reverses animations added by |
| 30 // |-animateFromBeginFrame:toEndFrame:duration:timingFunction:|. |
| 31 - (void)reverseAnimations; |
| 32 |
| 33 // Removes animations added by |
| 34 // |-animateFromBeginFrame:toEndFrame:duration:timingFunction:|. |
| 35 - (void)cleanUpAnimations; |
| 36 |
| 37 @end |
| 38 |
| 39 #endif // IOS_CHROME_BROWSER_UI_FADE_TRUNCATED_LABEL_H_ |
OLD | NEW |