问题
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:
- add 2 UITextfields and set their borders to none
- add background image having rounded corner from top left and top right to the 1st uitextfield i.e. username uitextfield
- add background image having rounded corner from bottom left and bottom right to the 2nd uitextfield i.e. password uitextfield
- 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