Last active
August 29, 2015 14:08
-
-
Save jebai0521/a4b10b410bd1c2a70afe to your computer and use it in GitHub Desktop.
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
| NSNumber* old = @(600); | |
| NSNumber* new = @(300); | |
| NSString* oldStr = [NSString stringWithFormat:@"¥%@ ", old]; | |
| NSString* newStr = [NSString stringWithFormat:@"¥%@ ", new]; | |
| NSAttributedString* oldAttrStr = [[NSAttributedString alloc] initWithString:oldStr attributes:@{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleNone), NSForegroundColorAttributeName:[UIColor blackColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:20]}]; | |
| NSAttributedString* newAttrStr = [[NSAttributedString alloc] initWithString:newStr attributes:@{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle), NSForegroundColorAttributeName:[UIColor grayColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:20]}]; | |
| NSMutableAttributedString* full = [[NSMutableAttributedString alloc] initWithAttributedString:oldAttrStr]; | |
| [full appendAttributedString:[[NSAttributedString alloc] initWithString:@" - " attributes:@{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleNone), NSForegroundColorAttributeName:[UIColor grayColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:20]}]]; | |
| [full appendAttributedString:newAttrStr]; | |
| [_label setAttributedText:full]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment