how to change UISearchBar from round to rectangle?

后端 未结 12 1550
没有蜡笔的小新
没有蜡笔的小新 2021-02-09 01:54

i will like to know how do i need to change a UISearchBar from the default round curve to a rectangle.

\"enter

12条回答
  •  感情败类
    2021-02-09 02:25

    I would use a UIView, with these features:
    - set your frame.
    - import CoreGraphics in your class
    - set a white background of the view
    - set view.layer.cornerRadius=10;
    - set view.layer.borderWidth=8;
    - set view.layer.borderColor=[UIColor blackColor].CGColor;
    - insert a label(with a clear background) inside the created view
    For the button on the left i would use an uiimage, for the right button set textField.clearButtonMode= UITextFieldViewModeAlways;

    Hope this helps.

提交回复
热议问题