{"id":22215118,"url":"https://github.com/zonghongyan/evncustomsearchbar","last_synced_at":"2025-10-08T22:43:35.038Z","repository":{"id":56909590,"uuid":"105131325","full_name":"zonghongyan/EVNCustomSearchBar","owner":"zonghongyan","description":"🔍Born for iOS 11 and iPhone X SearchBar","archived":false,"fork":false,"pushed_at":"2018-01-14T07:55:38.000Z","size":737,"stargazers_count":52,"open_issues_count":0,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-08T22:43:33.898Z","etag":null,"topics":["ios11","iphone-x","iphonex","navigationbar","searchbar","xcode9"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zonghongyan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-28T09:47:23.000Z","updated_at":"2025-02-23T06:07:41.000Z","dependencies_parsed_at":"2022-08-21T04:20:34.472Z","dependency_job_id":null,"html_url":"https://github.com/zonghongyan/EVNCustomSearchBar","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/zonghongyan/EVNCustomSearchBar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonghongyan%2FEVNCustomSearchBar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonghongyan%2FEVNCustomSearchBar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonghongyan%2FEVNCustomSearchBar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonghongyan%2FEVNCustomSearchBar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zonghongyan","download_url":"https://codeload.github.com/zonghongyan/EVNCustomSearchBar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonghongyan%2FEVNCustomSearchBar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000780,"owners_count":26082851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios11","iphone-x","iphonex","navigationbar","searchbar","xcode9"],"created_at":"2024-12-02T21:26:05.881Z","updated_at":"2025-10-08T22:43:35.010Z","avatar_url":"https://github.com/zonghongyan.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## EVNCustomSearchBar\n🔍Born for iOS 11 and iPhone X SearchBar\n\n[![Build Status](https://travis-ci.org/zonghongyan/EVNCustomSearchBar.svg?branch=master)](https://travis-ci.org/zonghongyan/EVNTouchIDDemo)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/EVNCustomSearchBar.svg)](https://img.shields.io/cocoapods/v/EVNCustomSearchBar.svg)\n[![License](https://img.shields.io/github/license/zonghongyan/EVNCustomSearchBar.svg?style=flat)](https://github.com/zonghongyan/EVNCustomSearchBar/blob/master/LICENSE)\n\n### 预览图\n\n\u003cimg src=\"https://github.com/zonghongyan/EVNCustomSearchBar/blob/master/EVNCustomSearchBarDemo/EVNCustomSearchBar.gif\" width=\"20%\" height=\"20%\" alt=\"other iPhone\" \u003e\n\n\u003cimg src=\"https://github.com/zonghongyan/EVNCustomSearchBar/blob/master/EVNCustomSearchBarDemo/EVNCustomSearchBar2.gif\" width=\"20%\" height=\"20%\" alt=\"iPhone \" \u003e\n\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n\u003e CocoaPods 1.1.0+ is required to build EVNCustomSearchBar.\n\nTo integrate EVNCustomSearchBar into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\n#use_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n\npod 'EVNCustomSearchBar', '~\u003e 0.1.2'\n\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Use\n```\n- (void)viewDidLoad\n{\n    [super viewDidLoad];\n    // Do any additional setup after loading the view, typically from a nib.\n\n    [self initSearchBar];\n}\n\n- (void)didReceiveMemoryWarning {\n    [super didReceiveMemoryWarning];\n    // Dispose of any resources that can be recreated.\n}\n\n#pragma mark: 设置顶部导航搜索部分\n- (void)initSearchBar\n{\n    self.navigationItem.titleView = self.searchBar;\n    if (@available(iOS 11.0, *))\n    {\n        [self.searchBar.heightAnchor constraintLessThanOrEqualToConstant:kEVNScreenNavigationBarHeight].active = YES;\n    }\n    else\n    {\n\n    }\n\n\n}\n\n#pragma mark: getter method EVNCustomSearchBar\n- (EVNCustomSearchBar *)searchBar\n{\n    if (!_searchBar)\n    {\n        _searchBar = [[EVNCustomSearchBar alloc] initWithFrame:CGRectMake(0, kEVNScreenStatusBarHeight, kEVNScreenWidth, kEVNScreenNavigationBarHeight)];\n\n        _searchBar.backgroundColor = [UIColor clearColor]; // 清空searchBar的背景色\n        _searchBar.iconImage = [UIImage imageNamed:@\"EVNCustomSearchBar.bundle/searchImageBlack.png\"];\n//        _searchBar.iconImage = [UIImage imageNamed:@\"EVNCustomSearchBar.bundle/searchImageTextColor.png\"];\n        _searchBar.iconAlign = EVNCustomSearchBarIconAlignCenter;\n        [_searchBar setPlaceholder:@\"请输入关键字\"];  // 搜索框的占位符\n        _searchBar.placeholderColor = TextGrayColor;\n        _searchBar.delegate = self; // 设置代理\n        [_searchBar sizeToFit];\n    }\n    return _searchBar;\n}\n\n#pragma mark: EVNCustomSearchBar delegate method\n- (BOOL)searchBarShouldBeginEditing:(EVNCustomSearchBar *)searchBar\n{\n    NSLog(@\"class: %@ function:%s\", NSStringFromClass([self class]), __func__);\n    return YES;\n}\n\n- (void)searchBarTextDidBeginEditing:(EVNCustomSearchBar *)searchBar\n{\n    NSLog(@\"class: %@ function:%s\", NSStringFromClass([self class]), __func__);\n}\n\n- (BOOL)searchBarShouldEndEditing:(EVNCustomSearchBar *)searchBar\n{\n    NSLog(@\"class: %@ function:%s\", NSStringFromClass([self class]), __func__);\n    return YES;\n}\n\n- (void)searchBarTextDidEndEditing:(EVNCustomSearchBar *)searchBar\n{\n    NSLog(@\"class: %@ function:%s\", NSStringFromClass([self class]), __func__);\n}\n\n- (void)searchBar:(EVNCustomSearchBar *)searchBar textDidChange:(NSString *)searchText\n{\n    NSLog(@\"class: %@ function:%s\", NSStringFromClass([self class]), __func__);\n}\n\n- (BOOL)searchBar:(EVNCustomSearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text\n{\n    NSLog(@\"class: %@ function:%s\", NSStringFromClass([self class]), __func__);\n    return YES;\n}\n\n- (void)searchBarSearchButtonClicked:(EVNCustomSearchBar *)searchBar\n{\n    NSLog(@\"class: %@ function:%s\", NSStringFromClass([self class]), __func__);\n}\n\n- (void)searchBarCancelButtonClicked:(EVNCustomSearchBar *)searchBar\n{\n    NSLog(@\"class: %@ function:%s\", NSStringFromClass([self class]), __func__);\n}\n\n- (void)touchesEnded:(NSSet\u003cUITouch *\u003e *)touches withEvent:(UIEvent *)event\n{\n    [self.searchBar resignFirstResponder];\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzonghongyan%2Fevncustomsearchbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzonghongyan%2Fevncustomsearchbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzonghongyan%2Fevncustomsearchbar/lists"}