How can i make a more rounded UITextField? Like the search field in Safari on iPad

后端 未结 5 950
夕颜
夕颜 2021-02-08 21:53

HI I\'m trying to get a UITextField to look like the google search field available in the safari app on iPad. The purpose of the field will be the same (a search box).

I

5条回答
  •  情书的邮戳
    2021-02-08 22:13

    You can set the Corner-Radius on any UIView-Subclass.

    1. Add the QuartzCore.framework to your project
    2. add #import in your UIViewController Subclass (where you have access to the UITextfield instance of your choice
    3. within viewDidLoad / viewWillAppear (or any other place where your UITextfield is allready instantiated call [yourTextField.layer setCornerRadius:14.0f];
    4. play around with the cornerRadius value until it looks good

提交回复
热议问题