2014-10-11 38 views

回答

3

您可以通過代碼設置標題通過標題字符串一些空白間距(「E xample」),或用製表符(\ t)或通過這樣的代碼:

let attributedString = NSMutableAttributedString(string: "Example") 
attributedString.addAttribute(NSKernAttributeName, value: CGFloat(1.4), range: NSRange(location: 0, length: 9)) 

然後分配歸於您的標題。

+2

這對我和Xcode 8.3,雨燕3.1沒有工作 – 2017-03-31 21:05:36

1

波紋管功能爲我工作,希望這可以幫助你太

func setCharacterSpacig(string:String) -> NSMutableAttributedString { 

    let attributedStr = NSMutableAttributedString(string: string) 
    attributedStr.addAttribute(NSKernAttributeName, value: 1.25, range: NSMakeRange(0, attributedStr.length)) 
    return attributedStr 
}