title: How to limit text length to fit width of dynamically created UITextField
body: <p>I have dynamically created <code>UITextFields</code> which have different widths and font sizes. I know how to limit length of text in <code>UITextField</code>, but I can do this only with fixed characters number. What I need is dynamically limit characters number to fit certain <code>UITextFields</code>. I suppose that every time new character is typed I should use <code>CGSize</code> and get text length for the certain font size than compare it with UITextField width and limit the characters number if it exceeded <code>UITextField</code> width. Unfortunately I am not sure how to start it. Does anyone know any code snippets that could help me?</p>