How do I create connected text fields in ios?

五迷三道 提交于 2019-12-13 02:08:19

问题


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

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


回答1:


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

Giving UIView rounded corners




回答2:


  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.


来源:https://stackoverflow.com/questions/31640488/how-do-i-create-connected-text-fields-in-ios

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