Where can I get the magnifying glass icon used in UISearchBar?

后端 未结 4 741
离开以前
离开以前 2020-12-31 20:27

I\'m using UITextField as a UISearchBar replacement and \"stealing\" the magnifying glass icon from the original UISearchBar with this

4条回答
  •  我在风中等你
    2020-12-31 21:07

    So, here's the code with the unicode character:

        UILabel *magnifyingGlass = [[UILabel alloc] init];
        [magnifyingGlass setText:[[NSString alloc] initWithUTF8String:"\xF0\x9F\x94\x8D"]];
        [magnifyingGlass sizeToFit];
    
        [textField setLeftView:magnifyingGlass];
        [textField setLeftViewMode:UITextFieldViewModeAlways];
    

    Edit: For plain look that fits iOS 7 style, add Unicode variation selector \U000025B6.

提交回复
热议问题