NSMutableAttributedString常用代码

NSTextAttachment *attachment = [[NSTextAttachment alloc] init];

attachment.image = [UIImage imageNamed:@"mine_chat_popview_jinyan_icon"];

attachment.bounds = CGRectMake(0, -5, 21, 21);

NSMutableAttributedString *attributed = [[NSMutableAttributedString alloc] initWithAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]];

NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"禁言"];

[str addAttribute:NSForegroundColorAttributeName value:MAKECOLOR(28, 210, 133) range:NSMakeRange(0,2)];

[attributed appendAttributedString:str];

[self.jinyanBtn setAttributedTitle:attributed forState:UIControlStateNormal];

上一篇:Git技巧:右键菜单怎么去除?


下一篇:CE选择目录对话框(转)