Skip to content

Instantly share code, notes, and snippets.

@mona-zsh
Created April 13, 2015 01:02
Show Gist options
  • Select an option

  • Save mona-zsh/212c974da3e3cef9256e to your computer and use it in GitHub Desktop.

Select an option

Save mona-zsh/212c974da3e3cef9256e to your computer and use it in GitHub Desktop.
NSString+Truncate.h
//
// 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