how to change UISearchBar from round to rectangle?

后端 未结 12 1551
没有蜡笔的小新
没有蜡笔的小新 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条回答
  •  闹比i
    闹比i (楼主)
    2021-02-09 02:30

    Could you try this.

        for (UIView *searchBarSubview in [search_bar subviews]) {
            if ([searchBarSubview conformsToProtocol:@protocol(UITextInputTraits)]) {
                if([searchBarSubview isKindOfClass:[UITextField class]])
                {
                    [(UITextField *)searchBarSubview setBorderStyle:UITextBorderStyleRoundedRect];
                }
            }
        }
    

提交回复
热议问题