多个颜色和字体

2020-07-17  本文已影响0人  adalillian

颜色

    NSString* priceString = [NSStringstringWithFormat:@"%@",model.Id];

    NSMutableAttributedString* string = [[NSMutableAttributedString alloc] initWithString:priceString];

    [stringaddAttribute:NSForegroundColorAttributeName value:range:NSMakeRange(3,priceString.length - 3)];

    [stringaddAttribute:NSFontAttributeName  value:range:NSMakeRange(3,priceString.length - 3)];

    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:self.thirdLabel.text];

    NSDictionary * dic = @{NSFontAttributeName :REGULAR14FONT,NSForegroundColorAttributeName:kRGB(164, 165, 166),};

    [straddAttributes:dic range:NSMakeRange(0,5)];

    NSDictionary * rdic = @{NSFontAttributeName :MEDIUM18FONT,NSForegroundColorAttributeName:kRGB(240, 80, 84),};

    [straddAttributes:rdic range:NSMakeRange(5,self.thirdLabel.text.length - 5)];

    self.thirdLabel.attributedText = str;

iOS 跳转到指定tabBar界面

self.tabBarController.selectedIndex =1;

上一篇 下一篇

猜你喜欢

热点阅读