NSString *price = @"¥12.3 ¥23.4";//[NSString stringWithFormat: @"¥%@ ¥%@ %@",goodsItemPrice,goodsItemOriginPrice,numByUserStr] ; NSMutableAttributedString *currentPriceStr = [[NSMutableAttributedString alloc] initWithString:price]; [currentPriceStr addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13],NSForegroundColorAttributeName:[UIColor blackColor]} range:NSMakeRange(0, 5)]; [currentPriceStr addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:[UIColor greenColor]} range:NSMakeRange(6, 5)]; [currentPriceStr addAttributes:@{NSStrikethroughStyleAttributeName:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle)} range:NSMakeRange(6, 5)]; self.goodsPrice.attributedText = currentPriceStr;
上面一段代码原本是有后面价格是有中划线的,但是到iOS10.3就无效了。
后测试发现:
1、字符串中有中文字符就会设置失效;
2、对字符串部分设置中划线也失效了。
修复:
方法一、假如对一整段设置中划线,只要没有中文字符串就行,用“¥”替代“¥”。
方法二、这个比较通用,不管有没有中文还是部分字符串设置都可以的,增加一个富文本属性: NSBaselineOffsetAttributeName : @(NSUnderlineStyleSingle)
相关推荐
系统升级到iOS10.3后,真机调试时Xcode运行程序到真机报错,提示Could not find developer disk image,Xcode Device栏处的真机右侧显示“(unavailable)” 步骤如下: 把10.3 (14E5239d).zip解压后拷贝到 /...
xcode配置iOS10.3开发包 解决iOS 10.3升级后无法真机测试 Could not find Developer Disk Image
Xcode DeviceSupport ios 10.3 Xcode DeviceSupport ios 10.3Xcode DeviceSupport ios 10.3
iOS 10.3 DeveloperDisk Image,安装详情请见https://blog.csdn.net/sinat_29106727/article/details/79929965
xcode iOS10.3 (14E5239d)真机测试包
解决 xcode8不支持ios10.3,将10.3zip包解压缩后放置路径:xcode打开包内容 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
将Xcode适配可以编译iOS 10.3版本的设备
iOS 10.3真机调试包
iPhone手机系统升级到10.3之后,你会发现无法进行真机测试了,并且提示Could not locate device support files或者Could not find Developer Disk Image,This iPhone is running iOS 10.3, which may not be ...
iPhone手机系统升级到10.3之后,你会发现无法进行真机测试了,并且提示Could not locate device support files或者Could not find Developer Disk Image,This iPhone is running iOS 10.3, which may not be ...
Xcode iOS10.3的配置包 给需要真机调试iOS10.3版本手机又不想升级Xcode的童鞋
iOS10.3 xcode
ios 10.3 xcode配置包
可以在iOS10.3真机调试的包
iOS10.3真机调试xcode包,使xcode能在真机10.3上调试
ios10.3beta2证书下载,没有证书无法安装
xcode ios10.3 deviceSupport包
iOS 10.3 iphone真机测试包
iOS10.3配置包
Xcode iOS10.3的配置包 给需要真机调试手机版本为iOS10.3.X的,Xcode最新版本已经不能满足需求的童鞋。谨慎点升级啊小伙伴们!