2016-08-03 2 views
0

내 코드에서 맞춤 글꼴을 사용하고 있습니다. 그것을 사용하면 문자가 UI 문제를 일으키는 한 줄로 정렬되지 않습니다. enter image description hereiOS의 맞춤 글꼴 맞춤 설정을 관리합니다.

어떤 도움 : enter image description here

나는 그것을 아래처럼 보일 수 있도록 글꼴이나 라벨 설정을 변경하려면?

답변

0

나는 Font 스타일로 인해 텍스트를 NSAttributedString String으로 설정하고 이에 따라 Font를 관리 할 수 ​​있다고 생각합니다. 이 경우 Attributes이 다른 두 개의 NSMutableAttributedString을 만들고이를 사용하십시오.

extension String { 

    func getText() -> NSAttributedString { 
     let str1 = "Hello" 
     let str2 = "750" 

     //create attribute 
     let attStr1  = NSMutableAttributedString(string: str1) 
     let attFormat = [NSFontAttributeName : UIFont.systemFontOfSize(10.0)] 
     let attString = NSMutableAttributedString(string: str2, attributes: attFormat) 
     attString.appendAttributedString(attStr1) 

     return attString 
    } 
} 

귀하의 요구 사항에 따라 Attribute을 작성하면 올바르게 작동합니다.