我的tableViewCell
中的每个optional(1)
都正确显示,但只有我的attributeString输出为“ let mString = String(self.productList?["market_price"].int)
let attributeString: NSMutableAttributedString = NSMutableAttributedString(string: mString)
attributeString.addAttribute(NSStrikethroughStyleAttributeName, value: 2, rnge: NSMakeRange(0, attributeString.length))
attributeString.addAttribute(NSStrikethroughColorAttributeName, value: UIColor.lightGrayColor(), range: NSMakeRange(0, attributeString.length))
self.marketPriceLabel.attributedText = attributeString
”
@Bean(initMethod = "init")
public MainContentPane mainContentPane() {...}
@Bean
public LockScreen lockScreen() {...}
@Bean
public LockScreenLockedController lockScreenLockedController() {...}
@Bean
public UserStateBinder userStateBinder() {...}
@Bean
public SessionHandler sessionHandler() {...}
答案 0 :(得分:0)
我找到了解决方案。
let mInt: Int = (self.productList?["market_price"].int)!
let mString: String = String(mInt)
let attributeString: NSMutableAttributedString = NSMutableAttributedString(string: mString)
attributeString.addAttribute(NSStrikethroughStyleAttributeName, value: 2, rnge: NSMakeRange(0, attributeString.length))
attributeString.addAttribute(NSStrikethroughColorAttributeName, value: UIColor.lightGrayColor(), range: NSMakeRange(0, attributeString.length))
self.marketPriceLabel.attributedText = attributeString