Is Rounded Corners on Attributed Text Background possible?

依然范特西╮ 提交于 2019-12-05 00:21:40

问题


I attributed Text with different textcolors. For better readability on highlighted text i use backgroundcolor. Is it possible to bring the CALayer Effect of Rounded Corners on this Textarea? Not the whole Area but the special Text inside of it.

My Code:

NSAttributedString *text = [[NSAttributedString alloc] initWithString:@"Highlighted Text"
                                                                          attributes:@{
                                                                                       NSFontAttributeName:            [UIFont fontWithName:@"HelveticaNeue" size:10.0f],
                                                                                       NSForegroundColorAttributeName: [UIColor lightGrayColor],
                                                                                       NSBackgroundColorAttributeName: [UIColor darkGrayColor]
                                                                                       }];

来源:https://stackoverflow.com/questions/19144145/is-rounded-corners-on-attributed-text-background-possible

工具导航Map

JSON相关