Created
April 13, 2015 01:02
-
-
Save mona-zsh/212c974da3e3cef9256e to your computer and use it in GitHub Desktop.
NSString+Truncate.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // NSString+Truncate.h | |
| // EMLabel | |
| // | |
| // Created by Mona Zhang on 3/31/15. | |
| // Copyright (c) 2015 Mona Zhang. All rights reserved. | |
| // | |
| #import <UIKit/UIKit.h> | |
| #import <Foundation/Foundation.h> | |
| typedef enum { | |
| EMTruncationModeSubtraction = 0, | |
| EMTruncationModeAddition = 1, | |
| EMTruncationModeBinarySearch = 2 | |
| } EMTruncationMode; | |
| @interface NSString (Truncate) | |
| - (NSAttributedString *)attributedStringByTruncatingToSize:(CGSize)size | |
| attributes:(NSDictionary *)attributes | |
| trailingString:(NSString *)trailingString | |
| color:(UIColor *)color | |
| truncationMode:(EMTruncationMode)truncationMode; | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment