如何在UILabel Swift IOS中添加Stroke

问题描述 投票:-1回答:1

在向UILabel App Crashes添加Stroke时


由于发现零而崩溃

let strokeTextAttributes = [
    NSAttributedStringKey.strokeColor : UIColor.green,
    NSAttributedStringKey.foregroundColor : UIColor.lightGray,
    NSAttributedStringKey.strokeWidth : -4.0,
    NSAttributedStringKey.font : UIFont.boldSystemFont(ofSize: 52)
    ] as [NSAttributedStringKey : Any]

hello_cell_lb.attributedText = NSAttributedString(string: "\(hello_array[indexPath.row])", attributes: strokeTextAttributes)
ios swift nsattributedstring
1个回答
0
投票

您似乎在单元格中为零标签添加笔划,但它在此处起作用

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.