开发者

Creating a view for user to fill up a form

开发者 https://www.devze.com 2023-03-15 18:50 出处:网络
I\'m creating a view which provides some fields for the user to fill in - address, phone number etc. I\'ve seen apps that have populated fields with grey text like \'Fill in your name here\' on the N

I'm creating a view which provides some fields for the user to fill in - address, phone number etc.

I've seen apps that have populated fields with grey text like 'Fill in your name here' on the Name field, and when the user taps on it the text is gone, a keyboard appears and the view is zoomed in to the textfield(or whatever it is). Also, after filling up that field tapping the 'Next' button on the keyboard brings the user to the next field. I'm trying to do the same but I have no idea where to get sources on this. Pardon my poor googling skills ;p

Tried UITextView and UITextField but there isn't anything related to this on the Interface Builder. Figured it lies with the codes?

It'd be great if I can get some explanation or some links on how this works (: Thanks!

EDIT: okay I played around with the In开发者_Go百科terface Builder a lil more and realized I could set placeholder as the grey text.


It is in fact a UITextField.

  1. You can get the greyed out text by setting its placeholder property.
  2. I am not sure what you mean by zooming but usually they do use a scroll view or adjust the frame so that it isn't blocked by the keyboard.
  3. The Next button is made available using a UIToolbar instance as the text field's inputAccessoryView. However the implementation is one's own and is not framework provided. You can look at this example to get started.
0

精彩评论

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