Resize UITextField horizontally with text using Auto Layout

对着背影说爱祢 提交于 2019-11-30 19:35:51

I am setting a placeholder. However wide the placeholder is, the width of the UITextField's intrinsicContentSize will never drop below it. So if the placeholder's width is 130, and I begin to type, the text view's width will remain at 130 until what I am typing reaches a width greater than 130; after this the text view will grow.

I think you'll have to use a UITextField subclass where you get to set the instrinsicContentSize, overriding the default behavior of the intrinsicContentSize method which is evidently to size based on the placeholder.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!