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
Post a Comment