Change font in UITextInput

245 Views Asked by At

I'm trying to develop a keyboard and it should use a different font then the default one. Here's the line:

   override func textDidChange(textInput: UITextInput?) {

    textInput.font = UIFont(name: "font name", size: 30)

}

But it doesn't work.... How can I fix it? Thanks.

1

There are 1 best solutions below

7
On

Follow this steps to use custom Fonts

  1. Drag and drop your font into Xcode
  2. Choose options for adding these files: Copy items if needed Create groups Add to targets:(your app name)
  3. In your Info.plist file add a key named: Fonts provided by application, which is an array
  4. Customize your font:

     myUILabel.text = "demoText"
     myUILabel.font = UIFont(name: "myCustomFont.ttf", size: 25)