How do I create connected text fields in ios?

2019-08-14 04:41发布

I want to create a login screen similar to facebook's for my iOS app.

sample

How do I create 2 text-fields that are both in that rounded box?

2条回答
【Aperson】
2楼-- · 2019-08-14 05:10
  1. add 2 UITextfields and set their borders to none
  2. add background image having rounded corner from top left and top right to the 1st uitextfield i.e. username uitextfield
  3. add background image having rounded corner from bottom left and bottom right to the 2nd uitextfield i.e. password uitextfield
  4. add a bordered layer (CALayer), set layer properties like, borderwidth, borderColor and frame as per your requirement and add this layer to uitextfield layer.
查看更多
Root(大扎)
3楼-- · 2019-08-14 05:14

Embed two textfields in a UIView and give that view the layer.cornerRadius that you need

Giving UIView rounded corners

查看更多
登录 后发表回答