xcode6 - How to automatically adjust the width of a centered UITextfield in Swift while editing? -


i have custom uitextfield x-centered superview via constraint. has height-constraint , nice thin line right under text has same width textfield (like said: custom). want keep uitextfield centered while editing content, adjusting in width string content.

what right happens keeps width while editing, cropping overlapping content.

my code kind of

// on textfields editing change event @ibaction func namefieldeditingchanged(sender: anyobject) {     // set width of textfield width of textstring     checkusernametextfieldwidth() }  func checkusernametextfieldwidth(){     println("checkusernametextfieldwidth \(username.text) / \(username.frame.size.width) / \(view.bounds.width)")      // has happen here guess...  } 

thnx!

you have use uitextview instead of uitextfield , apply sizethatfits method (see this response)


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -