开发者

Scrollability without Editability inside a UITextField

开发者 https://www.devze.com 2023-03-20 09:23 出处:网络
I want to use UITextFields for inputting relatively small amounts of text. The text can be longer than the size of the text field, and I want the user to be able to touch/scroll in开发者_C百科side the

I want to use UITextFields for inputting relatively small amounts of text. The text can be longer than the size of the text field, and I want the user to be able to touch/scroll in开发者_C百科side the text field in order to be able to read all of it.

This type of semi-scroll-like behavior is available in edit mode, but I don't want the user to be able to edit, just scroll. The keyboard shouldn't come up in other words. (I do allow the user to do editing, but that's in another section of the app.)

I'm suspecting that UITextField wasn't built to do what I'm trying to do and that I should go explore the capabilities of UITextView instead. Since I've already made a fair investment in providing the infrastructure to support UITextField editing (when it's needed, just not in the current circumstances), I'm a bit reluctant to abandon UITextFields altogether.

Does anyone see a way of doing what I want to be able to do?

Howard


y dont u use UITextView instead of textfield with small size


Use a scroll view with the UILabel as the subview of the scroll view?

Alternatively, use a UITextView and set its editable property to NO. If you are worried about the styling of the textview, use the plain style and customized with other UI elements.

0

精彩评论

暂无评论...
验证码 换一张
取 消