├── LLSearchView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── wanglonglong.xcuserdatad │ └── xcschemes │ ├── LLSearchView.xcscheme │ └── xcschememanagement.plist ├── LLSearchView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── HTVedio_left_slide.imageset │ │ ├── Contents.json │ │ └── popBack@2x.png │ ├── Home_Search.imageset │ │ ├── Contents.json │ │ ├── icon_search_48@2x.png │ │ └── icon_search_48@3x.png │ ├── NavBar_backImg.imageset │ │ ├── Contents.json │ │ ├── 回.png │ │ └── 店铺首页2_03.png │ ├── back_Image.imageset │ │ ├── Contents.json │ │ └── product_new_nav_back@2x.png │ ├── clearImage.imageset │ │ ├── Contents.json │ │ └── clearImage@2x.png │ ├── icon_wangge.imageset │ │ ├── Contents.json │ │ ├── icon_shitu@2x.png │ │ └── icon_shitu@3x.png │ ├── img_back_black.imageset │ │ ├── Contents.json │ │ └── img_back_black@2x.png │ ├── nav_list_double.imageset │ │ ├── Contents.json │ │ └── nav_list_double@2x.png │ ├── nav_list_single.imageset │ │ ├── Contents.json │ │ ├── icon_liebiao@2x-1.png │ │ └── icon_liebiao@3x.png │ ├── sort_magnifier.imageset │ │ ├── Contents.json │ │ └── sort_magnifier@2x.png │ ├── sort_recycle.imageset │ │ ├── Contents.json │ │ └── sort_recycle@2x.png │ ├── sort_search_bar_delete.imageset │ │ ├── Contents.json │ │ └── sort_search_bar_delete@2x.png │ └── sort_search_fake_bar.imageset │ │ ├── Contents.json │ │ └── sort_search_fake_bar@2x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── LLSearchResultDoubleViewCell.h ├── LLSearchResultDoubleViewCell.m ├── LLSearchResultListViewCell.h ├── LLSearchResultListViewCell.m ├── LLSearchResultView.h ├── LLSearchResultView.m ├── LLSearchResultViewController.h ├── LLSearchResultViewController.m ├── LLSearchSuggestionVC.h ├── LLSearchSuggestionVC.m ├── LLSearchView.h ├── LLSearchView.m ├── LLSearchView.pch ├── LLSearchViewController.h ├── LLSearchViewController.m ├── ViewController.h ├── ViewController.m ├── leftImage220.jpg ├── leftImage345.jpg ├── leftImage576.jpg ├── main.m ├── rightImage220.jpg ├── rightImage345.jpg └── rightImage576.jpg ├── LLSearchViewUITests ├── Info.plist └── LLSearchViewUITests.m ├── README.md ├── 搜索.gif └── 搜索1.gif /LLSearchView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 03552A6F1F26EE8900518BD3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552A6E1F26EE8900518BD3 /* main.m */; }; 11 | 03552A721F26EE8900518BD3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552A711F26EE8900518BD3 /* AppDelegate.m */; }; 12 | 03552A751F26EE8900518BD3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552A741F26EE8900518BD3 /* ViewController.m */; }; 13 | 03552A781F26EE8900518BD3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 03552A761F26EE8900518BD3 /* Main.storyboard */; }; 14 | 03552A7A1F26EE8A00518BD3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 03552A791F26EE8A00518BD3 /* Assets.xcassets */; }; 15 | 03552A7D1F26EE8A00518BD3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 03552A7B1F26EE8A00518BD3 /* LaunchScreen.storyboard */; }; 16 | 03552A881F26EE8A00518BD3 /* LLSearchViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552A871F26EE8A00518BD3 /* LLSearchViewUITests.m */; }; 17 | 03552A941F26EF0900518BD3 /* LLSearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552A931F26EF0900518BD3 /* LLSearchViewController.m */; }; 18 | 03552A971F26EF9300518BD3 /* LLSearchResultViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552A961F26EF9300518BD3 /* LLSearchResultViewController.m */; }; 19 | 03552A9A1F26EFCD00518BD3 /* LLSearchSuggestionVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552A991F26EFCD00518BD3 /* LLSearchSuggestionVC.m */; }; 20 | 03552A9D1F26F02200518BD3 /* LLSearchView.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552A9C1F26F02200518BD3 /* LLSearchView.m */; }; 21 | 03552AA01F26F07B00518BD3 /* LLSearchResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552A9F1F26F07B00518BD3 /* LLSearchResultView.m */; }; 22 | 03552AA31F26F10100518BD3 /* LLSearchResultListViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552AA21F26F10100518BD3 /* LLSearchResultListViewCell.m */; }; 23 | 03552AA61F26F12500518BD3 /* LLSearchResultDoubleViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 03552AA51F26F12500518BD3 /* LLSearchResultDoubleViewCell.m */; }; 24 | 03552AAD1F26F1E200518BD3 /* leftImage220.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 03552AA71F26F1E200518BD3 /* leftImage220.jpg */; }; 25 | 03552AAE1F26F1E200518BD3 /* rightImage220.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 03552AA81F26F1E200518BD3 /* rightImage220.jpg */; }; 26 | 03552AAF1F26F1E200518BD3 /* leftImage345.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 03552AA91F26F1E200518BD3 /* leftImage345.jpg */; }; 27 | 03552AB01F26F1E200518BD3 /* rightImage345.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 03552AAA1F26F1E200518BD3 /* rightImage345.jpg */; }; 28 | 03552AB11F26F1E200518BD3 /* rightImage576.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 03552AAB1F26F1E200518BD3 /* rightImage576.jpg */; }; 29 | 03552AB21F26F1E200518BD3 /* leftImage576.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 03552AAC1F26F1E200518BD3 /* leftImage576.jpg */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXContainerItemProxy section */ 33 | 03552A841F26EE8A00518BD3 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 03552A621F26EE8800518BD3 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 03552A691F26EE8800518BD3; 38 | remoteInfo = LLSearchView; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | 03552A6A1F26EE8800518BD3 /* LLSearchView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LLSearchView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 03552A6E1F26EE8900518BD3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 45 | 03552A701F26EE8900518BD3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 03552A711F26EE8900518BD3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 03552A731F26EE8900518BD3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 48 | 03552A741F26EE8900518BD3 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 49 | 03552A771F26EE8900518BD3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 03552A791F26EE8A00518BD3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 51 | 03552A7C1F26EE8A00518BD3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 52 | 03552A7E1F26EE8A00518BD3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 03552A831F26EE8A00518BD3 /* LLSearchViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LLSearchViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 03552A871F26EE8A00518BD3 /* LLSearchViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLSearchViewUITests.m; sourceTree = ""; }; 55 | 03552A891F26EE8A00518BD3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 03552A921F26EF0900518BD3 /* LLSearchViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LLSearchViewController.h; sourceTree = ""; }; 57 | 03552A931F26EF0900518BD3 /* LLSearchViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LLSearchViewController.m; sourceTree = ""; }; 58 | 03552A951F26EF9300518BD3 /* LLSearchResultViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LLSearchResultViewController.h; sourceTree = ""; }; 59 | 03552A961F26EF9300518BD3 /* LLSearchResultViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LLSearchResultViewController.m; sourceTree = ""; }; 60 | 03552A981F26EFCD00518BD3 /* LLSearchSuggestionVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LLSearchSuggestionVC.h; sourceTree = ""; }; 61 | 03552A991F26EFCD00518BD3 /* LLSearchSuggestionVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LLSearchSuggestionVC.m; sourceTree = ""; }; 62 | 03552A9B1F26F02200518BD3 /* LLSearchView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LLSearchView.h; sourceTree = ""; }; 63 | 03552A9C1F26F02200518BD3 /* LLSearchView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LLSearchView.m; sourceTree = ""; }; 64 | 03552A9E1F26F07B00518BD3 /* LLSearchResultView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LLSearchResultView.h; sourceTree = ""; }; 65 | 03552A9F1F26F07B00518BD3 /* LLSearchResultView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LLSearchResultView.m; sourceTree = ""; }; 66 | 03552AA11F26F10100518BD3 /* LLSearchResultListViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LLSearchResultListViewCell.h; sourceTree = ""; }; 67 | 03552AA21F26F10100518BD3 /* LLSearchResultListViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LLSearchResultListViewCell.m; sourceTree = ""; }; 68 | 03552AA41F26F12500518BD3 /* LLSearchResultDoubleViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LLSearchResultDoubleViewCell.h; sourceTree = ""; }; 69 | 03552AA51F26F12500518BD3 /* LLSearchResultDoubleViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LLSearchResultDoubleViewCell.m; sourceTree = ""; }; 70 | 03552AA71F26F1E200518BD3 /* leftImage220.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = leftImage220.jpg; sourceTree = ""; }; 71 | 03552AA81F26F1E200518BD3 /* rightImage220.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = rightImage220.jpg; sourceTree = ""; }; 72 | 03552AA91F26F1E200518BD3 /* leftImage345.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = leftImage345.jpg; sourceTree = ""; }; 73 | 03552AAA1F26F1E200518BD3 /* rightImage345.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = rightImage345.jpg; sourceTree = ""; }; 74 | 03552AAB1F26F1E200518BD3 /* rightImage576.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = rightImage576.jpg; sourceTree = ""; }; 75 | 03552AAC1F26F1E200518BD3 /* leftImage576.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = leftImage576.jpg; sourceTree = ""; }; 76 | 03552AB31F26F23300518BD3 /* LLSearchView.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLSearchView.pch; sourceTree = ""; }; 77 | /* End PBXFileReference section */ 78 | 79 | /* Begin PBXFrameworksBuildPhase section */ 80 | 03552A671F26EE8800518BD3 /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | 03552A801F26EE8A00518BD3 /* Frameworks */ = { 88 | isa = PBXFrameworksBuildPhase; 89 | buildActionMask = 2147483647; 90 | files = ( 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | /* End PBXFrameworksBuildPhase section */ 95 | 96 | /* Begin PBXGroup section */ 97 | 03552A611F26EE8800518BD3 = { 98 | isa = PBXGroup; 99 | children = ( 100 | 03552A6C1F26EE8800518BD3 /* LLSearchView */, 101 | 03552A861F26EE8A00518BD3 /* LLSearchViewUITests */, 102 | 03552A6B1F26EE8800518BD3 /* Products */, 103 | ); 104 | sourceTree = ""; 105 | }; 106 | 03552A6B1F26EE8800518BD3 /* Products */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 03552A6A1F26EE8800518BD3 /* LLSearchView.app */, 110 | 03552A831F26EE8A00518BD3 /* LLSearchViewUITests.xctest */, 111 | ); 112 | name = Products; 113 | sourceTree = ""; 114 | }; 115 | 03552A6C1F26EE8800518BD3 /* LLSearchView */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 03552A701F26EE8900518BD3 /* AppDelegate.h */, 119 | 03552A711F26EE8900518BD3 /* AppDelegate.m */, 120 | 03552A731F26EE8900518BD3 /* ViewController.h */, 121 | 03552A741F26EE8900518BD3 /* ViewController.m */, 122 | 03552A921F26EF0900518BD3 /* LLSearchViewController.h */, 123 | 03552A931F26EF0900518BD3 /* LLSearchViewController.m */, 124 | 03552A951F26EF9300518BD3 /* LLSearchResultViewController.h */, 125 | 03552A961F26EF9300518BD3 /* LLSearchResultViewController.m */, 126 | 03552A981F26EFCD00518BD3 /* LLSearchSuggestionVC.h */, 127 | 03552A991F26EFCD00518BD3 /* LLSearchSuggestionVC.m */, 128 | 03552A9B1F26F02200518BD3 /* LLSearchView.h */, 129 | 03552A9C1F26F02200518BD3 /* LLSearchView.m */, 130 | 03552A9E1F26F07B00518BD3 /* LLSearchResultView.h */, 131 | 03552A9F1F26F07B00518BD3 /* LLSearchResultView.m */, 132 | 03552AA11F26F10100518BD3 /* LLSearchResultListViewCell.h */, 133 | 03552AA21F26F10100518BD3 /* LLSearchResultListViewCell.m */, 134 | 03552AA41F26F12500518BD3 /* LLSearchResultDoubleViewCell.h */, 135 | 03552AA51F26F12500518BD3 /* LLSearchResultDoubleViewCell.m */, 136 | 03552A761F26EE8900518BD3 /* Main.storyboard */, 137 | 03552AA71F26F1E200518BD3 /* leftImage220.jpg */, 138 | 03552AA81F26F1E200518BD3 /* rightImage220.jpg */, 139 | 03552AA91F26F1E200518BD3 /* leftImage345.jpg */, 140 | 03552AAA1F26F1E200518BD3 /* rightImage345.jpg */, 141 | 03552AAB1F26F1E200518BD3 /* rightImage576.jpg */, 142 | 03552AAC1F26F1E200518BD3 /* leftImage576.jpg */, 143 | 03552A791F26EE8A00518BD3 /* Assets.xcassets */, 144 | 03552A7B1F26EE8A00518BD3 /* LaunchScreen.storyboard */, 145 | 03552AB31F26F23300518BD3 /* LLSearchView.pch */, 146 | 03552A7E1F26EE8A00518BD3 /* Info.plist */, 147 | 03552A6D1F26EE8900518BD3 /* Supporting Files */, 148 | ); 149 | path = LLSearchView; 150 | sourceTree = ""; 151 | }; 152 | 03552A6D1F26EE8900518BD3 /* Supporting Files */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 03552A6E1F26EE8900518BD3 /* main.m */, 156 | ); 157 | name = "Supporting Files"; 158 | sourceTree = ""; 159 | }; 160 | 03552A861F26EE8A00518BD3 /* LLSearchViewUITests */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | 03552A871F26EE8A00518BD3 /* LLSearchViewUITests.m */, 164 | 03552A891F26EE8A00518BD3 /* Info.plist */, 165 | ); 166 | path = LLSearchViewUITests; 167 | sourceTree = ""; 168 | }; 169 | /* End PBXGroup section */ 170 | 171 | /* Begin PBXNativeTarget section */ 172 | 03552A691F26EE8800518BD3 /* LLSearchView */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = 03552A8C1F26EE8A00518BD3 /* Build configuration list for PBXNativeTarget "LLSearchView" */; 175 | buildPhases = ( 176 | 03552A661F26EE8800518BD3 /* Sources */, 177 | 03552A671F26EE8800518BD3 /* Frameworks */, 178 | 03552A681F26EE8800518BD3 /* Resources */, 179 | ); 180 | buildRules = ( 181 | ); 182 | dependencies = ( 183 | ); 184 | name = LLSearchView; 185 | productName = LLSearchView; 186 | productReference = 03552A6A1F26EE8800518BD3 /* LLSearchView.app */; 187 | productType = "com.apple.product-type.application"; 188 | }; 189 | 03552A821F26EE8A00518BD3 /* LLSearchViewUITests */ = { 190 | isa = PBXNativeTarget; 191 | buildConfigurationList = 03552A8F1F26EE8A00518BD3 /* Build configuration list for PBXNativeTarget "LLSearchViewUITests" */; 192 | buildPhases = ( 193 | 03552A7F1F26EE8A00518BD3 /* Sources */, 194 | 03552A801F26EE8A00518BD3 /* Frameworks */, 195 | 03552A811F26EE8A00518BD3 /* Resources */, 196 | ); 197 | buildRules = ( 198 | ); 199 | dependencies = ( 200 | 03552A851F26EE8A00518BD3 /* PBXTargetDependency */, 201 | ); 202 | name = LLSearchViewUITests; 203 | productName = LLSearchViewUITests; 204 | productReference = 03552A831F26EE8A00518BD3 /* LLSearchViewUITests.xctest */; 205 | productType = "com.apple.product-type.bundle.ui-testing"; 206 | }; 207 | /* End PBXNativeTarget section */ 208 | 209 | /* Begin PBXProject section */ 210 | 03552A621F26EE8800518BD3 /* Project object */ = { 211 | isa = PBXProject; 212 | attributes = { 213 | LastUpgradeCheck = 0830; 214 | ORGANIZATIONNAME = "王龙龙"; 215 | TargetAttributes = { 216 | 03552A691F26EE8800518BD3 = { 217 | CreatedOnToolsVersion = 8.3.3; 218 | DevelopmentTeam = 36H94N4GDC; 219 | ProvisioningStyle = Automatic; 220 | }; 221 | 03552A821F26EE8A00518BD3 = { 222 | CreatedOnToolsVersion = 8.3.3; 223 | DevelopmentTeam = 36H94N4GDC; 224 | ProvisioningStyle = Automatic; 225 | TestTargetID = 03552A691F26EE8800518BD3; 226 | }; 227 | }; 228 | }; 229 | buildConfigurationList = 03552A651F26EE8800518BD3 /* Build configuration list for PBXProject "LLSearchView" */; 230 | compatibilityVersion = "Xcode 3.2"; 231 | developmentRegion = English; 232 | hasScannedForEncodings = 0; 233 | knownRegions = ( 234 | en, 235 | Base, 236 | ); 237 | mainGroup = 03552A611F26EE8800518BD3; 238 | productRefGroup = 03552A6B1F26EE8800518BD3 /* Products */; 239 | projectDirPath = ""; 240 | projectRoot = ""; 241 | targets = ( 242 | 03552A691F26EE8800518BD3 /* LLSearchView */, 243 | 03552A821F26EE8A00518BD3 /* LLSearchViewUITests */, 244 | ); 245 | }; 246 | /* End PBXProject section */ 247 | 248 | /* Begin PBXResourcesBuildPhase section */ 249 | 03552A681F26EE8800518BD3 /* Resources */ = { 250 | isa = PBXResourcesBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | 03552AAE1F26F1E200518BD3 /* rightImage220.jpg in Resources */, 254 | 03552AB01F26F1E200518BD3 /* rightImage345.jpg in Resources */, 255 | 03552AAF1F26F1E200518BD3 /* leftImage345.jpg in Resources */, 256 | 03552AB11F26F1E200518BD3 /* rightImage576.jpg in Resources */, 257 | 03552A7D1F26EE8A00518BD3 /* LaunchScreen.storyboard in Resources */, 258 | 03552AAD1F26F1E200518BD3 /* leftImage220.jpg in Resources */, 259 | 03552A7A1F26EE8A00518BD3 /* Assets.xcassets in Resources */, 260 | 03552AB21F26F1E200518BD3 /* leftImage576.jpg in Resources */, 261 | 03552A781F26EE8900518BD3 /* Main.storyboard in Resources */, 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | }; 265 | 03552A811F26EE8A00518BD3 /* Resources */ = { 266 | isa = PBXResourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | /* End PBXResourcesBuildPhase section */ 273 | 274 | /* Begin PBXSourcesBuildPhase section */ 275 | 03552A661F26EE8800518BD3 /* Sources */ = { 276 | isa = PBXSourcesBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | 03552A941F26EF0900518BD3 /* LLSearchViewController.m in Sources */, 280 | 03552A751F26EE8900518BD3 /* ViewController.m in Sources */, 281 | 03552A721F26EE8900518BD3 /* AppDelegate.m in Sources */, 282 | 03552A9D1F26F02200518BD3 /* LLSearchView.m in Sources */, 283 | 03552A971F26EF9300518BD3 /* LLSearchResultViewController.m in Sources */, 284 | 03552AA31F26F10100518BD3 /* LLSearchResultListViewCell.m in Sources */, 285 | 03552A9A1F26EFCD00518BD3 /* LLSearchSuggestionVC.m in Sources */, 286 | 03552A6F1F26EE8900518BD3 /* main.m in Sources */, 287 | 03552AA61F26F12500518BD3 /* LLSearchResultDoubleViewCell.m in Sources */, 288 | 03552AA01F26F07B00518BD3 /* LLSearchResultView.m in Sources */, 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | }; 292 | 03552A7F1F26EE8A00518BD3 /* Sources */ = { 293 | isa = PBXSourcesBuildPhase; 294 | buildActionMask = 2147483647; 295 | files = ( 296 | 03552A881F26EE8A00518BD3 /* LLSearchViewUITests.m in Sources */, 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | /* End PBXSourcesBuildPhase section */ 301 | 302 | /* Begin PBXTargetDependency section */ 303 | 03552A851F26EE8A00518BD3 /* PBXTargetDependency */ = { 304 | isa = PBXTargetDependency; 305 | target = 03552A691F26EE8800518BD3 /* LLSearchView */; 306 | targetProxy = 03552A841F26EE8A00518BD3 /* PBXContainerItemProxy */; 307 | }; 308 | /* End PBXTargetDependency section */ 309 | 310 | /* Begin PBXVariantGroup section */ 311 | 03552A761F26EE8900518BD3 /* Main.storyboard */ = { 312 | isa = PBXVariantGroup; 313 | children = ( 314 | 03552A771F26EE8900518BD3 /* Base */, 315 | ); 316 | name = Main.storyboard; 317 | sourceTree = ""; 318 | }; 319 | 03552A7B1F26EE8A00518BD3 /* LaunchScreen.storyboard */ = { 320 | isa = PBXVariantGroup; 321 | children = ( 322 | 03552A7C1F26EE8A00518BD3 /* Base */, 323 | ); 324 | name = LaunchScreen.storyboard; 325 | sourceTree = ""; 326 | }; 327 | /* End PBXVariantGroup section */ 328 | 329 | /* Begin XCBuildConfiguration section */ 330 | 03552A8A1F26EE8A00518BD3 /* Debug */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | ALWAYS_SEARCH_USER_PATHS = NO; 334 | CLANG_ANALYZER_NONNULL = YES; 335 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 336 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 337 | CLANG_CXX_LIBRARY = "libc++"; 338 | CLANG_ENABLE_MODULES = YES; 339 | CLANG_ENABLE_OBJC_ARC = YES; 340 | CLANG_WARN_BOOL_CONVERSION = YES; 341 | CLANG_WARN_CONSTANT_CONVERSION = YES; 342 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 343 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 344 | CLANG_WARN_EMPTY_BODY = YES; 345 | CLANG_WARN_ENUM_CONVERSION = YES; 346 | CLANG_WARN_INFINITE_RECURSION = YES; 347 | CLANG_WARN_INT_CONVERSION = YES; 348 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 349 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 350 | CLANG_WARN_UNREACHABLE_CODE = YES; 351 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 352 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 353 | COPY_PHASE_STRIP = NO; 354 | DEBUG_INFORMATION_FORMAT = dwarf; 355 | ENABLE_STRICT_OBJC_MSGSEND = YES; 356 | ENABLE_TESTABILITY = YES; 357 | GCC_C_LANGUAGE_STANDARD = gnu99; 358 | GCC_DYNAMIC_NO_PIC = NO; 359 | GCC_NO_COMMON_BLOCKS = YES; 360 | GCC_OPTIMIZATION_LEVEL = 0; 361 | GCC_PREPROCESSOR_DEFINITIONS = ( 362 | "DEBUG=1", 363 | "$(inherited)", 364 | ); 365 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 366 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 367 | GCC_WARN_UNDECLARED_SELECTOR = YES; 368 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 369 | GCC_WARN_UNUSED_FUNCTION = YES; 370 | GCC_WARN_UNUSED_VARIABLE = YES; 371 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 372 | MTL_ENABLE_DEBUG_INFO = YES; 373 | ONLY_ACTIVE_ARCH = YES; 374 | SDKROOT = iphoneos; 375 | }; 376 | name = Debug; 377 | }; 378 | 03552A8B1F26EE8A00518BD3 /* Release */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ALWAYS_SEARCH_USER_PATHS = NO; 382 | CLANG_ANALYZER_NONNULL = YES; 383 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 384 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 385 | CLANG_CXX_LIBRARY = "libc++"; 386 | CLANG_ENABLE_MODULES = YES; 387 | CLANG_ENABLE_OBJC_ARC = YES; 388 | CLANG_WARN_BOOL_CONVERSION = YES; 389 | CLANG_WARN_CONSTANT_CONVERSION = YES; 390 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 391 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 392 | CLANG_WARN_EMPTY_BODY = YES; 393 | CLANG_WARN_ENUM_CONVERSION = YES; 394 | CLANG_WARN_INFINITE_RECURSION = YES; 395 | CLANG_WARN_INT_CONVERSION = YES; 396 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 397 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 398 | CLANG_WARN_UNREACHABLE_CODE = YES; 399 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 400 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 401 | COPY_PHASE_STRIP = NO; 402 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 403 | ENABLE_NS_ASSERTIONS = NO; 404 | ENABLE_STRICT_OBJC_MSGSEND = YES; 405 | GCC_C_LANGUAGE_STANDARD = gnu99; 406 | GCC_NO_COMMON_BLOCKS = YES; 407 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 408 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 409 | GCC_WARN_UNDECLARED_SELECTOR = YES; 410 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 411 | GCC_WARN_UNUSED_FUNCTION = YES; 412 | GCC_WARN_UNUSED_VARIABLE = YES; 413 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 414 | MTL_ENABLE_DEBUG_INFO = NO; 415 | SDKROOT = iphoneos; 416 | VALIDATE_PRODUCT = YES; 417 | }; 418 | name = Release; 419 | }; 420 | 03552A8D1F26EE8A00518BD3 /* Debug */ = { 421 | isa = XCBuildConfiguration; 422 | buildSettings = { 423 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 424 | DEVELOPMENT_TEAM = 36H94N4GDC; 425 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 426 | GCC_PREFIX_HEADER = "$(SRCROOT)/LLSearchView/LLSearchView.pch"; 427 | INFOPLIST_FILE = LLSearchView/Info.plist; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 429 | PRODUCT_BUNDLE_IDENTIFIER = wangll.LLSearchView; 430 | PRODUCT_NAME = "$(TARGET_NAME)"; 431 | }; 432 | name = Debug; 433 | }; 434 | 03552A8E1F26EE8A00518BD3 /* Release */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 438 | DEVELOPMENT_TEAM = 36H94N4GDC; 439 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 440 | GCC_PREFIX_HEADER = "$(SRCROOT)/LLSearchView/LLSearchView.pch"; 441 | INFOPLIST_FILE = LLSearchView/Info.plist; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 443 | PRODUCT_BUNDLE_IDENTIFIER = wangll.LLSearchView; 444 | PRODUCT_NAME = "$(TARGET_NAME)"; 445 | }; 446 | name = Release; 447 | }; 448 | 03552A901F26EE8A00518BD3 /* Debug */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | DEVELOPMENT_TEAM = 36H94N4GDC; 452 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 453 | GCC_PREFIX_HEADER = "$(SRCROOT)/LLSearchView/LLSearchView.pch"; 454 | INFOPLIST_FILE = LLSearchViewUITests/Info.plist; 455 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 456 | PRODUCT_BUNDLE_IDENTIFIER = wangll.LLSearchViewUITests; 457 | PRODUCT_NAME = "$(TARGET_NAME)"; 458 | TEST_TARGET_NAME = LLSearchView; 459 | }; 460 | name = Debug; 461 | }; 462 | 03552A911F26EE8A00518BD3 /* Release */ = { 463 | isa = XCBuildConfiguration; 464 | buildSettings = { 465 | DEVELOPMENT_TEAM = 36H94N4GDC; 466 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 467 | GCC_PREFIX_HEADER = "$(SRCROOT)/LLSearchView/LLSearchView.pch"; 468 | INFOPLIST_FILE = LLSearchViewUITests/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 470 | PRODUCT_BUNDLE_IDENTIFIER = wangll.LLSearchViewUITests; 471 | PRODUCT_NAME = "$(TARGET_NAME)"; 472 | TEST_TARGET_NAME = LLSearchView; 473 | }; 474 | name = Release; 475 | }; 476 | /* End XCBuildConfiguration section */ 477 | 478 | /* Begin XCConfigurationList section */ 479 | 03552A651F26EE8800518BD3 /* Build configuration list for PBXProject "LLSearchView" */ = { 480 | isa = XCConfigurationList; 481 | buildConfigurations = ( 482 | 03552A8A1F26EE8A00518BD3 /* Debug */, 483 | 03552A8B1F26EE8A00518BD3 /* Release */, 484 | ); 485 | defaultConfigurationIsVisible = 0; 486 | defaultConfigurationName = Release; 487 | }; 488 | 03552A8C1F26EE8A00518BD3 /* Build configuration list for PBXNativeTarget "LLSearchView" */ = { 489 | isa = XCConfigurationList; 490 | buildConfigurations = ( 491 | 03552A8D1F26EE8A00518BD3 /* Debug */, 492 | 03552A8E1F26EE8A00518BD3 /* Release */, 493 | ); 494 | defaultConfigurationIsVisible = 0; 495 | defaultConfigurationName = Release; 496 | }; 497 | 03552A8F1F26EE8A00518BD3 /* Build configuration list for PBXNativeTarget "LLSearchViewUITests" */ = { 498 | isa = XCConfigurationList; 499 | buildConfigurations = ( 500 | 03552A901F26EE8A00518BD3 /* Debug */, 501 | 03552A911F26EE8A00518BD3 /* Release */, 502 | ); 503 | defaultConfigurationIsVisible = 0; 504 | defaultConfigurationName = Release; 505 | }; 506 | /* End XCConfigurationList section */ 507 | }; 508 | rootObject = 03552A621F26EE8800518BD3 /* Project object */; 509 | } 510 | -------------------------------------------------------------------------------- /LLSearchView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LLSearchView.xcodeproj/xcuserdata/wanglonglong.xcuserdatad/xcschemes/LLSearchView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /LLSearchView.xcodeproj/xcuserdata/wanglonglong.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LLSearchView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 03552A691F26EE8800518BD3 16 | 17 | primary 18 | 19 | 20 | 03552A821F26EE8A00518BD3 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LLSearchView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /LLSearchView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | } 43 | ], 44 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/HTVedio_left_slide.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "popBack@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/HTVedio_left_slide.imageset/popBack@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/HTVedio_left_slide.imageset/popBack@2x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/Home_Search.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_search_48@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "icon_search_48@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/Home_Search.imageset/icon_search_48@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/Home_Search.imageset/icon_search_48@2x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/Home_Search.imageset/icon_search_48@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/Home_Search.imageset/icon_search_48@3x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/NavBar_backImg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "店铺首页2_03.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "回.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/NavBar_backImg.imageset/回.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/NavBar_backImg.imageset/回.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/NavBar_backImg.imageset/店铺首页2_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/NavBar_backImg.imageset/店铺首页2_03.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/back_Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "product_new_nav_back@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/back_Image.imageset/product_new_nav_back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/back_Image.imageset/product_new_nav_back@2x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/clearImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "clearImage@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/clearImage.imageset/clearImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/clearImage.imageset/clearImage@2x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/icon_wangge.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_shitu@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "icon_shitu@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/icon_wangge.imageset/icon_shitu@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/icon_wangge.imageset/icon_shitu@2x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/icon_wangge.imageset/icon_shitu@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/icon_wangge.imageset/icon_shitu@3x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/img_back_black.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "img_back_black@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/img_back_black.imageset/img_back_black@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/img_back_black.imageset/img_back_black@2x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/nav_list_double.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "nav_list_double@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/nav_list_double.imageset/nav_list_double@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/nav_list_double.imageset/nav_list_double@2x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/nav_list_single.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_liebiao@2x-1.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "icon_liebiao@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/nav_list_single.imageset/icon_liebiao@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/nav_list_single.imageset/icon_liebiao@2x-1.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/nav_list_single.imageset/icon_liebiao@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/nav_list_single.imageset/icon_liebiao@3x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/sort_magnifier.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "sort_magnifier@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/sort_magnifier.imageset/sort_magnifier@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/sort_magnifier.imageset/sort_magnifier@2x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/sort_recycle.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "sort_recycle@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/sort_recycle.imageset/sort_recycle@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/sort_recycle.imageset/sort_recycle@2x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/sort_search_bar_delete.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "sort_search_bar_delete@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/sort_search_bar_delete.imageset/sort_search_bar_delete@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/sort_search_bar_delete.imageset/sort_search_bar_delete@2x.png -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/sort_search_fake_bar.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "sort_search_fake_bar@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LLSearchView/Assets.xcassets/sort_search_fake_bar.imageset/sort_search_fake_bar@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/Assets.xcassets/sort_search_fake_bar.imageset/sort_search_fake_bar@2x.png -------------------------------------------------------------------------------- /LLSearchView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LLSearchView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /LLSearchView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchResultDoubleViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchResultDoubleViewCell.h 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define KWidth (KScreenWidth > 375 ? 576/3 : 345/2) 12 | #define kSpace (KScreenWidth - KWidth * 2) / 3 13 | 14 | @interface LLSearchResultDoubleViewCell : UITableViewCell 15 | 16 | - (void)configResultDoubleViewCellWithFirstTitle:(NSString *)firstTitle secondTitle:(NSString *)secondTitle; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchResultDoubleViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchResultDoubleViewCell.m 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import "LLSearchResultDoubleViewCell.h" 10 | 11 | @interface LLSearchResultDoubleViewCell () 12 | 13 | @property (nonatomic, strong) UIImageView *leftImage; 14 | @property (nonatomic, strong) UILabel *leftTitle; 15 | @property (nonatomic, strong) UIImageView *rightImage; 16 | @property (nonatomic, strong) UILabel *rightTitle; 17 | 18 | @end 19 | 20 | @implementation LLSearchResultDoubleViewCell 21 | 22 | 23 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 24 | { 25 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 26 | self.selectionStyle = UITableViewCellSelectionStyleNone; 27 | [self.contentView addSubview:self.leftImage]; 28 | [self.contentView addSubview:self.leftTitle]; 29 | [self.contentView addSubview:self.rightImage]; 30 | [self.contentView addSubview:self.rightTitle]; 31 | UIView *line = [[UIView alloc] initWithFrame:CGRectMake(kSpace, CGRectGetMaxY(_leftTitle.frame) + 9, KScreenWidth - kSpace * 2, 1)]; 32 | line.backgroundColor = KColor(241, 241, 241); 33 | [self.contentView addSubview:line]; 34 | 35 | } 36 | return self; 37 | } 38 | 39 | - (UIImageView *)leftImage 40 | { 41 | if (!_leftImage) { 42 | self.leftImage = [[UIImageView alloc] initWithFrame:CGRectMake(kSpace, 10, KWidth, KWidth)]; 43 | _leftImage.backgroundColor = [UIColor purpleColor]; 44 | } 45 | return _leftImage; 46 | } 47 | 48 | - (UILabel *)leftTitle 49 | { 50 | if (!_leftTitle) { 51 | self.leftTitle = [[UILabel alloc] initWithFrame:CGRectMake(kSpace, CGRectGetMaxY(_leftImage.frame) + 10, KWidth, 20)]; 52 | _leftTitle.textAlignment = NSTextAlignmentCenter; 53 | _leftTitle.font = [UIFont systemFontOfSize:12]; 54 | } 55 | return _leftTitle; 56 | } 57 | 58 | - (UIImageView *)rightImage 59 | { 60 | if (!_rightImage) { 61 | self.rightImage = [[UIImageView alloc] initWithFrame:CGRectMake(KScreenWidth - kSpace - KWidth, 10, KWidth, KWidth)]; 62 | _rightImage.backgroundColor = [UIColor yellowColor]; 63 | } 64 | return _rightImage; 65 | } 66 | 67 | - (UILabel *)rightTitle 68 | { 69 | if (!_rightTitle) { 70 | self.rightTitle = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(_rightImage.frame), CGRectGetMaxY(_rightImage.frame) + 10, KWidth, 20)]; 71 | _rightTitle.textAlignment = NSTextAlignmentCenter; 72 | _rightTitle.font = [UIFont systemFontOfSize:12]; 73 | } 74 | return _rightTitle; 75 | } 76 | 77 | 78 | - (void)configResultDoubleViewCellWithFirstTitle:(NSString *)firstTitle secondTitle:(NSString *)secondTitle 79 | { 80 | _leftTitle.text = firstTitle; 81 | if (KScreenWidth > 375) { 82 | _leftImage.image = [UIImage imageNamed:@"leftImage576.jpg"]; 83 | _rightImage.image = [UIImage imageNamed:@"rightImage576.jpg"]; 84 | } else { 85 | _leftImage.image = [UIImage imageNamed:@"leftImage345.jpg"]; 86 | _rightImage.image = [UIImage imageNamed:@"rightImage345.jpg"]; 87 | } 88 | 89 | if (secondTitle == nil) { 90 | _rightImage.hidden = YES; 91 | _rightTitle.hidden = YES; 92 | } else { 93 | _rightImage.hidden = NO; 94 | _rightTitle.hidden = NO; 95 | _rightTitle.text = secondTitle; 96 | } 97 | } 98 | 99 | 100 | - (void)awakeFromNib 101 | { 102 | [super awakeFromNib]; 103 | // Initialization code 104 | } 105 | 106 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 107 | { 108 | [super setSelected:selected animated:animated]; 109 | 110 | // Configure the view for the selected state 111 | } 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchResultListViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchResultListViewCell.h 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LLSearchResultListViewCell : UITableViewCell 12 | 13 | - (void)configResultListViewCellWithTitle:(NSString *)title cellRow:(NSInteger)row; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchResultListViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchResultListViewCell.m 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import "LLSearchResultListViewCell.h" 10 | 11 | @interface LLSearchResultListViewCell () 12 | 13 | @property (nonatomic, strong) UIImageView *itemImg; 14 | @property (nonatomic, strong) UILabel *itemTitle; 15 | 16 | @end 17 | 18 | @implementation LLSearchResultListViewCell 19 | 20 | 21 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 22 | { 23 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 24 | [self setSubViews]; 25 | self.selectionStyle = UITableViewCellSelectionStyleNone; 26 | } 27 | return self; 28 | } 29 | 30 | - (UIImageView *)itemImg 31 | { 32 | if (!_itemImg) { 33 | self.itemImg = [[UIImageView alloc] initWithFrame:CGRectMake(10, 5, 110, 110)]; 34 | } 35 | return _itemImg; 36 | } 37 | 38 | 39 | - (UILabel *)itemTitle 40 | { 41 | if (!_itemTitle) { 42 | self.itemTitle = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_itemImg.frame) + 10, CGRectGetMidY(_itemImg.frame) - 10, KScreenWidth - 54, 20)]; 43 | _itemTitle.textAlignment = NSTextAlignmentLeft; 44 | _itemTitle.font = [UIFont systemFontOfSize:15]; 45 | } 46 | return _itemTitle; 47 | } 48 | 49 | 50 | - (void)setSubViews 51 | { 52 | [self.contentView addSubview:self.itemImg]; 53 | [self.contentView addSubview:self.itemTitle]; 54 | UIView *line = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_itemImg.frame) + 10, CGRectGetMaxY(_itemImg.frame) + 4, KScreenWidth - CGRectGetMaxX(_itemImg.frame) - 10, 1)]; 55 | line.backgroundColor = KColor(241, 241, 241); 56 | [self.contentView addSubview:line]; 57 | } 58 | 59 | - (void)configResultListViewCellWithTitle:(NSString *)title cellRow:(NSInteger)row 60 | { 61 | _itemTitle.text = title; 62 | if (row % 2 == 0) { 63 | _itemImg.image = [UIImage imageNamed:@"leftImage220.jpg"]; 64 | } else { 65 | _itemImg.image = [UIImage imageNamed:@"rightImage220.jpg"]; 66 | } 67 | } 68 | 69 | 70 | - (void)awakeFromNib 71 | { 72 | [super awakeFromNib]; 73 | // Initialization code 74 | } 75 | 76 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 77 | { 78 | [super setSelected:selected animated:animated]; 79 | 80 | // Configure the view for the selected state 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchResultView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchResultView.h 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LLSearchResultView : UIView 12 | 13 | - (instancetype)initWithFrame:(CGRect)frame dataSource:(NSMutableArray *)dataArr; 14 | 15 | - (void)refreshResultViewWithIsDouble:(BOOL)isDouble; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchResultView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchResultView.m 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import "LLSearchResultView.h" 10 | #import "LLSearchResultListViewCell.h" 11 | #import "LLSearchResultDoubleViewCell.h" 12 | 13 | @interface LLSearchResultView () 14 | 15 | @property (nonatomic, strong) UITableView *contentTableView; 16 | @property (nonatomic, strong) UICollectionView *contentCollectionView; 17 | @property (nonatomic, strong) NSMutableArray *dataSource; 18 | @property (nonatomic, assign) BOOL isDoubleList; 19 | 20 | @end 21 | @implementation LLSearchResultView 22 | 23 | - (instancetype)initWithFrame:(CGRect)frame dataSource:(NSMutableArray *)dataArr 24 | { 25 | if (self = [super initWithFrame:frame]) { 26 | self.dataSource = dataArr; 27 | _isDoubleList = YES; 28 | [self addSubview:self.contentTableView]; 29 | } 30 | return self; 31 | } 32 | 33 | - (NSMutableArray *)dataSource 34 | { 35 | if (!_dataSource) { 36 | self.dataSource = [NSMutableArray array]; 37 | } 38 | return _dataSource; 39 | } 40 | 41 | 42 | - (UITableView *)contentTableView 43 | { 44 | if (!_contentTableView) { 45 | self.contentTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) style:UITableViewStylePlain]; 46 | _contentTableView.delegate = self; 47 | _contentTableView.dataSource = self; 48 | _contentTableView.separatorStyle = UITableViewCellSeparatorStyleNone; 49 | [_contentTableView registerClass:[LLSearchResultListViewCell class] forCellReuseIdentifier:@"SearchResultListViewCell"]; 50 | [_contentTableView registerClass:[LLSearchResultDoubleViewCell class] forCellReuseIdentifier:@"SearchResultDoubleViewCell"]; 51 | } 52 | return _contentTableView; 53 | } 54 | 55 | - (void)refreshResultViewWithIsDouble:(BOOL)isDouble 56 | { 57 | _isDoubleList = isDouble; 58 | [_contentTableView reloadData]; 59 | } 60 | 61 | 62 | #pragma mark - UITableViewDataSource - 63 | 64 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 65 | { 66 | return 1; 67 | } 68 | 69 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 70 | { 71 | NSInteger count = _dataSource.count; 72 | if (_isDoubleList) { 73 | if (count % 2 > 0) { 74 | return count / 2 + 1; 75 | } else { 76 | return count / 2; 77 | } 78 | } else { 79 | return count; 80 | } 81 | } 82 | 83 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 84 | { 85 | if (!_isDoubleList) { 86 | LLSearchResultListViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SearchResultListViewCell" forIndexPath:indexPath]; 87 | [cell configResultListViewCellWithTitle:_dataSource[indexPath.row] cellRow:indexPath.row]; 88 | return cell; 89 | } else { 90 | LLSearchResultDoubleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SearchResultDoubleViewCell" forIndexPath:indexPath]; 91 | NSInteger row = indexPath.row * 2; 92 | if (_dataSource.count % 2 > 0 && row + 1 == _dataSource.count) { 93 | [cell configResultDoubleViewCellWithFirstTitle:_dataSource[row] secondTitle:nil]; 94 | } else { 95 | [cell configResultDoubleViewCellWithFirstTitle:_dataSource[row] secondTitle:_dataSource[row + 1]]; 96 | } 97 | return cell; 98 | } 99 | } 100 | 101 | 102 | #pragma mark - UITableViewDelegate - 103 | 104 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 105 | { 106 | return _isDoubleList ? KWidth+50 : 120; 107 | } 108 | 109 | 110 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 111 | { 112 | 113 | } 114 | 115 | @end 116 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchResultViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchResultViewController.h 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LLSearchResultViewController : UIViewController 12 | 13 | @property (nonatomic, copy) NSString *searchStr; 14 | @property (nonatomic, strong) NSMutableArray *hotArray; 15 | @property (nonatomic, strong) NSMutableArray *historyArray; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchResultViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchResultViewController.m 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import "LLSearchResultViewController.h" 10 | #import "LLSearchViewController.h" 11 | #import "LLSearchSuggestionVC.h" 12 | #import "LLSearchResultView.h" 13 | #import "LLSearchView.h" 14 | 15 | @interface LLSearchResultViewController () 16 | 17 | @property (nonatomic, strong) NSMutableArray *searchArray; 18 | @property (nonatomic, strong) UISearchBar *searchBar; 19 | @property (nonatomic, strong) UIView *titleView; 20 | @property (nonatomic, strong) UIView *backView; 21 | @property (nonatomic, strong) UITextField *textField; 22 | @property (nonatomic, assign) BOOL activity; 23 | @property (nonatomic, strong) UIBarButtonItem *rightItem; 24 | @property (nonatomic, strong) LLSearchResultView *resultView; 25 | @property (nonatomic, strong) LLSearchView *searchView; 26 | @property (nonatomic, strong) LLSearchSuggestionVC *searchSuggestVC; 27 | 28 | @end 29 | 30 | @implementation LLSearchResultViewController 31 | 32 | - (NSMutableArray *)searchArray 33 | { 34 | if (!_searchArray) { 35 | self.searchArray = [NSMutableArray arrayWithObjects:@"芙丽芳丝补水保湿面膜", @"澳佳宝皇家玫瑰蚕丝面膜", @"科颜氏草本养颜面膜", @"自然乐园保湿控油小清新面膜", @"佰草集新七白面膜",@"美即水漾肌密补水保湿净化面", @"膜法世家白松露睡眠面膜", @"蜗牛玻尿酸蚕丝面膜", @"水密码补水保湿面膜", nil]; 36 | } 37 | return _searchArray; 38 | } 39 | 40 | 41 | - (LLSearchResultView *)resultView 42 | { 43 | if (!_resultView) { 44 | self.resultView = [[LLSearchResultView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) dataSource:self.searchArray]; 45 | } 46 | return _resultView; 47 | } 48 | 49 | 50 | - (LLSearchView *)searchView 51 | { 52 | if (!_searchView) { 53 | self.searchView = [[LLSearchView alloc] initWithFrame:CGRectMake(0, 64, KScreenWidth, KScreenHeight - 64) hotArray:self.hotArray historyArray:self.historyArray]; 54 | __weak LLSearchResultViewController *weakSelf = self; 55 | _searchView.backgroundColor = [UIColor whiteColor]; 56 | _searchView.tapAction = ^(NSString *str) { 57 | [weakSelf setSearchResultWithStr:str]; 58 | }; 59 | } 60 | return _searchView; 61 | } 62 | 63 | - (LLSearchSuggestionVC *)searchSuggestVC 64 | { 65 | if (!_searchSuggestVC) { 66 | self.searchSuggestVC = [[LLSearchSuggestionVC alloc] init]; 67 | _searchSuggestVC.view.frame = CGRectMake(0, 64, KScreenWidth, KScreenHeight - 64); 68 | _searchSuggestVC.view.hidden = YES; 69 | __weak LLSearchResultViewController *weakSelf = self; 70 | _searchSuggestVC.searchBlock = ^(NSString *searchTest) { 71 | [weakSelf setSearchResultWithStr:searchTest]; 72 | }; 73 | } 74 | return _searchSuggestVC; 75 | } 76 | 77 | 78 | - (void)viewDidLoad 79 | { 80 | [super viewDidLoad]; 81 | self.view.backgroundColor = [UIColor whiteColor]; 82 | [self setBarButtonItem]; 83 | [self.view addSubview:self.resultView]; 84 | [self.view addSubview:self.searchSuggestVC.view]; 85 | } 86 | 87 | - (void)setBarButtonItem 88 | { 89 | self.navigationController.interactivePopGestureRecognizer.delegate = (id)self; 90 | 91 | UIImage *img = [UIImage imageNamed:@"NavBar_backImg"]; 92 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 93 | btn.frame = CGRectMake(-10, 10, 22, 22); 94 | [btn setImage:img forState:UIControlStateNormal]; 95 | [btn addTarget:self action:@selector(presentVCFirstBackClick:) forControlEvents:UIControlEventTouchUpInside]; 96 | UIBarButtonItem *bbiBack = [[UIBarButtonItem alloc] initWithCustomView:btn]; 97 | 98 | self.titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 7, self.view.frame.size.width - 44 * 2 - 16, 30)]; 99 | 100 | self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(_titleView.frame), 30)]; 101 | _searchBar.text = _searchStr; 102 | _searchBar.backgroundImage = [UIImage imageNamed:@"clearImage"]; 103 | _searchBar.delegate = self; 104 | _searchBar.tintColor = [UIColor redColor]; 105 | 106 | UIView *searchTextField = searchTextField = [self.searchBar valueForKey:@"_searchField"]; 107 | searchTextField.backgroundColor = [UIColor colorWithRed:234/255.0 green:235/255.0 blue:237/255.0 alpha:1]; 108 | 109 | [self.searchBar setImage:[UIImage imageNamed:@"sort_magnifier"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal]; 110 | [_titleView addSubview:_searchBar]; 111 | 112 | self.navigationItem.titleView = _titleView; 113 | self.navigationItem.leftBarButtonItem = bbiBack; 114 | self.rightItem = [self setRightBarItem]; 115 | self.navigationItem.rightBarButtonItem = _rightItem; 116 | 117 | } 118 | 119 | 120 | - (UIBarButtonItem *)setRightBarItem 121 | { 122 | UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 123 | rightBtn.selected = NO; 124 | rightBtn.frame = CGRectMake(14, 7, 30, 30); 125 | [rightBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -10)]; 126 | [rightBtn setImage:[UIImage imageNamed:@"icon_wangge"] forState:UIControlStateNormal]; 127 | [rightBtn addTarget:self action:@selector(rightBtnItemAction:) forControlEvents:UIControlEventTouchUpInside]; 128 | UIBarButtonItem *rightBtnItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn]; 129 | return rightBtnItem; 130 | } 131 | 132 | - (void)rightBtnItemAction:(UIButton *)sender 133 | { 134 | sender.selected = !sender.selected; 135 | if (sender.selected) { 136 | [sender setImage:[UIImage imageNamed:@"nav_list_single"] forState:UIControlStateNormal]; 137 | [_resultView refreshResultViewWithIsDouble:NO]; 138 | } else { 139 | [sender setImage:[UIImage imageNamed:@"icon_wangge"] forState:UIControlStateNormal]; 140 | [_resultView refreshResultViewWithIsDouble:YES]; 141 | } 142 | } 143 | 144 | 145 | - (void)cancelDidClick 146 | { 147 | [_searchBar resignFirstResponder]; 148 | } 149 | 150 | - (void)presentVCFirstBackClick:(UIButton *)sender 151 | { 152 | [_searchBar resignFirstResponder]; 153 | [self.navigationController popToRootViewControllerAnimated:YES]; 154 | } 155 | 156 | 157 | - (void)setSearchResultWithStr:(NSString *)str 158 | { 159 | [self.searchBar resignFirstResponder]; 160 | _searchBar.text = str; 161 | [_searchView removeFromSuperview]; 162 | _searchSuggestVC.view.hidden = YES; 163 | } 164 | 165 | 166 | #pragma mark - UISearchBarDelegate - 167 | 168 | - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar 169 | { 170 | NSLog(@"searchBarShouldBeginEditing"); 171 | _activity = !_activity; 172 | if (_activity) { 173 | self.navigationItem.rightBarButtonItem = nil; 174 | _titleView.frame = CGRectMake(0, 7, self.view.frame.size.width - 44 - 16, 30); 175 | _searchBar.frame = CGRectMake(0, 0, CGRectGetWidth(_titleView.frame), 30); 176 | searchBar.showsCancelButton = YES; 177 | UIButton *cancleBtn = [_searchBar valueForKey:@"cancelButton"]; 178 | //修改标题和标题颜色 179 | [cancleBtn setTitle:@"取消" forState:UIControlStateNormal]; 180 | [cancleBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 181 | } 182 | 183 | return YES; 184 | } 185 | 186 | 187 | - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar 188 | { 189 | NSLog(@"searchBarTextDidBeginEditing-searchTest:%@",searchBar.text); 190 | if ([searchBar.text length] > 0) { 191 | _searchSuggestVC.view.hidden = NO; 192 | [self.view bringSubviewToFront:_searchSuggestVC.view]; 193 | [_searchSuggestVC searchTestChangeWithTest:searchBar.text]; 194 | } 195 | } 196 | 197 | - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar 198 | { 199 | NSLog(@"searchBarShouldEndEditing"); 200 | self.navigationItem.rightBarButtonItem = _rightItem; 201 | _titleView.frame = CGRectMake(0, 7, self.view.frame.size.width - 44 * 2 - 16, 30); 202 | _searchBar.frame = CGRectMake(0, 0, CGRectGetWidth(_titleView.frame), 30); 203 | searchBar.showsCancelButton = NO; 204 | _activity = NO; 205 | if (![searchBar.text length]) { 206 | _searchBar.text = _searchStr; 207 | [_searchView removeFromSuperview]; 208 | }; 209 | 210 | return YES; 211 | } 212 | 213 | - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar 214 | { 215 | NSLog(@"searchBarTextDidEndEditing"); 216 | } 217 | 218 | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText 219 | { 220 | NSLog(@"textDidChange"); 221 | 222 | if (searchBar.text == nil || [searchBar.text length] <= 0) { 223 | _searchSuggestVC.view.hidden = YES; 224 | [self.view addSubview:self.searchView]; 225 | [self.view bringSubviewToFront:_searchView]; 226 | } else { 227 | _searchSuggestVC.view.hidden = NO; 228 | [self.view bringSubviewToFront:_searchSuggestVC.view]; 229 | [_searchSuggestVC searchTestChangeWithTest:searchBar.text]; 230 | } 231 | } 232 | 233 | 234 | - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar 235 | { 236 | [self.searchBar resignFirstResponder]; 237 | self.navigationItem.rightBarButtonItem = _rightItem; 238 | _titleView.frame = CGRectMake(0, 7, self.view.frame.size.width - 44 * 2 - 16, 30); 239 | _searchBar.frame = CGRectMake(0, 0, CGRectGetWidth(_titleView.frame), 30); 240 | searchBar.showsCancelButton = NO; 241 | _activity = NO; 242 | 243 | _searchSuggestVC.view.hidden = YES; 244 | } 245 | 246 | 247 | - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar 248 | { 249 | NSLog(@"searchBarSearchButtonClicked"); 250 | [_searchView removeFromSuperview]; 251 | [self setSearchResultWithStr:searchBar.text]; 252 | } 253 | 254 | 255 | - (void)didReceiveMemoryWarning 256 | { 257 | [super didReceiveMemoryWarning]; 258 | // Dispose of any resources that can be recreated. 259 | } 260 | 261 | 262 | /* 263 | #pragma mark - Navigation 264 | 265 | // In a storyboard-based application, you will often want to do a little preparation before navigation 266 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 267 | // Get the new view controller using [segue destinationViewController]. 268 | // Pass the selected object to the new view controller. 269 | } 270 | */ 271 | 272 | @end 273 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchSuggestionVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchSuggestionVC.h 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void(^SuggestSelectBlock)(NSString *searchTest); 12 | @interface LLSearchSuggestionVC : UIViewController 13 | 14 | @property (nonatomic, copy) SuggestSelectBlock searchBlock; 15 | 16 | - (void)searchTestChangeWithTest:(NSString *)test; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchSuggestionVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchSuggestionVC.m 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import "LLSearchSuggestionVC.h" 10 | 11 | @interface LLSearchSuggestionVC () 12 | 13 | @property (nonatomic, strong) UITableView *contentView; 14 | @property (nonatomic, copy) NSString *searchTest; 15 | 16 | @end 17 | 18 | @implementation LLSearchSuggestionVC 19 | 20 | - (UITableView *)contentView 21 | { 22 | if (!_contentView) { 23 | self.contentView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) style:UITableViewStylePlain]; 24 | _contentView.delegate = self; 25 | _contentView.dataSource = self; 26 | _contentView.backgroundColor = [UIColor whiteColor]; 27 | _contentView.tableFooterView = [UIView new]; 28 | } 29 | return _contentView; 30 | } 31 | 32 | 33 | - (void)viewDidLoad 34 | { 35 | [super viewDidLoad]; 36 | [self.view addSubview:self.contentView]; 37 | } 38 | 39 | - (void)searchTestChangeWithTest:(NSString *)test 40 | { 41 | _searchTest = test; 42 | [_contentView reloadData]; 43 | } 44 | 45 | 46 | #pragma mark - UITableViewDataSource - 47 | 48 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 49 | { 50 | return 1; 51 | } 52 | 53 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 54 | { 55 | return (_searchTest.length > 0) ? (10 / _searchTest.length) : 0; 56 | } 57 | 58 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 59 | { 60 | static NSString *cellId = @"CellIdentifier"; 61 | UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId]; 62 | if (!cell) { 63 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; 64 | } 65 | cell.textLabel.text = [NSString stringWithFormat:@"%@编号%ld", _searchTest, indexPath.row]; 66 | return cell; 67 | } 68 | 69 | 70 | #pragma mark - UITableViewDelegate - 71 | 72 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 73 | { 74 | return 44; 75 | } 76 | 77 | 78 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 79 | { 80 | if (self.searchBlock) { 81 | self.searchBlock([NSString stringWithFormat:@"%@编号%ld", _searchTest, indexPath.row]); 82 | } 83 | } 84 | 85 | 86 | - (void)didReceiveMemoryWarning 87 | { 88 | [super didReceiveMemoryWarning]; 89 | // Dispose of any resources that can be recreated. 90 | } 91 | 92 | /* 93 | #pragma mark - Navigation 94 | 95 | // In a storyboard-based application, you will often want to do a little preparation before navigation 96 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 97 | // Get the new view controller using [segue destinationViewController]. 98 | // Pass the selected object to the new view controller. 99 | } 100 | */ 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchView.h 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void(^TapActionBlock)(NSString *str); 12 | @interface LLSearchView : UIView 13 | 14 | @property (nonatomic, copy) TapActionBlock tapAction; 15 | 16 | - (instancetype)initWithFrame:(CGRect)frame hotArray:(NSMutableArray *)hotArr historyArray:(NSMutableArray *)historyArr; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchView.m 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import "LLSearchView.h" 10 | 11 | @interface LLSearchView () 12 | 13 | @property (nonatomic, strong) UITableView *tableView; 14 | @property (nonatomic, strong) NSMutableArray *hotArray; 15 | @property (nonatomic, strong) NSMutableArray *historyArray; 16 | @property (nonatomic, strong) UIView *searchHistoryView; 17 | @property (nonatomic, strong) UIView *hotSearchView; 18 | 19 | @end 20 | @implementation LLSearchView 21 | 22 | - (instancetype)initWithFrame:(CGRect)frame hotArray:(NSMutableArray *)hotArr historyArray:(NSMutableArray *)historyArr 23 | { 24 | if (self = [super initWithFrame:frame]) { 25 | self.historyArray = historyArr; 26 | self.hotArray = hotArr; 27 | [self addSubview:self.searchHistoryView]; 28 | [self addSubview:self.hotSearchView]; 29 | } 30 | return self; 31 | } 32 | 33 | 34 | - (UIView *)hotSearchView 35 | { 36 | if (!_hotSearchView) { 37 | self.hotSearchView = [self setViewWithOriginY:CGRectGetHeight(_searchHistoryView.frame) title:@"热门搜索" textArr:self.hotArray]; 38 | } 39 | return _hotSearchView; 40 | } 41 | 42 | 43 | - (UIView *)searchHistoryView 44 | { 45 | if (!_searchHistoryView) { 46 | if (_historyArray.count > 0) { 47 | self.searchHistoryView = [self setViewWithOriginY:0 title:@"最近搜索" textArr:self.historyArray]; 48 | } else { 49 | self.searchHistoryView = [self setNoHistoryView]; 50 | } 51 | } 52 | return _searchHistoryView; 53 | } 54 | 55 | 56 | 57 | - (UIView *)setViewWithOriginY:(CGFloat)riginY title:(NSString *)title textArr:(NSMutableArray *)textArr 58 | { 59 | UIView *view = [[UIView alloc] init]; 60 | UILabel *titleL = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, KScreenWidth - 30 - 45, 30)]; 61 | titleL.text = title; 62 | titleL.font = [UIFont systemFontOfSize:15]; 63 | titleL.textColor = [UIColor blackColor]; 64 | titleL.textAlignment = NSTextAlignmentLeft; 65 | [view addSubview:titleL]; 66 | 67 | if ([title isEqualToString:@"最近搜索"]) { 68 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 69 | btn.frame = CGRectMake(KScreenWidth - 45, 10, 28, 30); 70 | [btn setImage:[UIImage imageNamed:@"sort_recycle"] forState:UIControlStateNormal]; 71 | [btn addTarget:self action:@selector(clearnSearchHistory:) forControlEvents:UIControlEventTouchUpInside]; 72 | [view addSubview:btn]; 73 | } 74 | 75 | CGFloat y = 10 + 40; 76 | CGFloat letfWidth = 15; 77 | for (int i = 0; i < textArr.count; i++) { 78 | NSString *text = textArr[i]; 79 | CGFloat width = [self getWidthWithStr:text] + 30; 80 | if (letfWidth + width + 15 > KScreenWidth) { 81 | if (y >= 130 && [title isEqualToString:@"最近搜索"]) { 82 | [self removeTestDataWithTextArr:textArr index:i]; 83 | break; 84 | } 85 | y += 40; 86 | letfWidth = 15; 87 | } 88 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(letfWidth, y, width, 30)]; 89 | label.userInteractionEnabled = YES; 90 | label.font = [UIFont systemFontOfSize:12]; 91 | label.text = text; 92 | label.layer.borderWidth = 0.5; 93 | label.layer.cornerRadius = 5; 94 | label.textAlignment = NSTextAlignmentCenter; 95 | if (i % 2 == 0 && [title isEqualToString:@"热门搜索"]) { 96 | label.layer.borderColor = KColor(255, 148, 153).CGColor; 97 | label.textColor = KColor(255, 148, 153); 98 | } else { 99 | label.textColor = KColor(111, 111, 111); 100 | label.layer.borderColor = KColor(227, 227, 227).CGColor; 101 | } 102 | [label addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tagDidCLick:)]]; 103 | [view addSubview:label]; 104 | letfWidth += width + 10; 105 | } 106 | view.frame = CGRectMake(0, riginY, KScreenWidth, y + 40); 107 | return view; 108 | } 109 | 110 | 111 | - (UIView *)setNoHistoryView 112 | { 113 | UIView *historyView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 80)]; 114 | UILabel *titleL = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, KScreenWidth - 30, 30)]; 115 | titleL.text = @"最近搜索"; 116 | titleL.font = [UIFont systemFontOfSize:15]; 117 | titleL.textColor = [UIColor blackColor]; 118 | titleL.textAlignment = NSTextAlignmentLeft; 119 | 120 | UILabel *notextL = [[UILabel alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(titleL.frame) + 10, 100, 20)]; 121 | notextL.text = @"无搜索历史"; 122 | notextL.font = [UIFont systemFontOfSize:12]; 123 | notextL.textColor = [UIColor blackColor]; 124 | notextL.textAlignment = NSTextAlignmentLeft; 125 | [historyView addSubview:titleL]; 126 | [historyView addSubview:notextL]; 127 | return historyView; 128 | } 129 | 130 | - (void)tagDidCLick:(UITapGestureRecognizer *)tap 131 | { 132 | UILabel *label = (UILabel *)tap.view; 133 | if (self.tapAction) { 134 | self.tapAction(label.text); 135 | } 136 | } 137 | 138 | - (CGFloat)getWidthWithStr:(NSString *)text 139 | { 140 | CGFloat width = [text boundingRectWithSize:CGSizeMake(KScreenWidth, 40) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12]} context:nil].size.width; 141 | return width; 142 | } 143 | 144 | 145 | - (void)clearnSearchHistory:(UIButton *)sender 146 | { 147 | [self.searchHistoryView removeFromSuperview]; 148 | self.searchHistoryView = [self setNoHistoryView]; 149 | [_historyArray removeAllObjects]; 150 | [NSKeyedArchiver archiveRootObject:_historyArray toFile:KHistorySearchPath]; 151 | [self addSubview:self.searchHistoryView]; 152 | CGRect frame = _hotSearchView.frame; 153 | frame.origin.y = CGRectGetHeight(_searchHistoryView.frame); 154 | _hotSearchView.frame = frame; 155 | } 156 | 157 | - (void)removeTestDataWithTextArr:(NSMutableArray *)testArr index:(int)index 158 | { 159 | NSRange range = {index, testArr.count - index - 1}; 160 | [testArr removeObjectsInRange:range]; 161 | [NSKeyedArchiver archiveRootObject:testArr toFile:KHistorySearchPath]; 162 | } 163 | 164 | 165 | 166 | @end 167 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchView.pch: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchView.pch 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #ifndef LLSearchView_pch 10 | #define LLSearchView_pch 11 | 12 | #define KScreenWidth [UIScreen mainScreen].bounds.size.width 13 | #define KScreenHeight [UIScreen mainScreen].bounds.size.height 14 | 15 | #define KHistorySearchPath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"PYSearchhistories.plist"] 16 | 17 | #define KColor(r,g,b) [UIColor colorWithRed:(r/255.0) green:(g/255.0) blue:(b/255.0) alpha:1.0] 18 | 19 | #endif /* LLSearchView_pch */ 20 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchViewController.h 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LLSearchViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LLSearchView/LLSearchViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchViewController.m 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import "LLSearchViewController.h" 10 | #import "LLSearchResultViewController.h" 11 | #import "LLSearchSuggestionVC.h" 12 | #import "LLSearchView.h" 13 | 14 | 15 | @interface LLSearchViewController () 16 | 17 | @property (nonatomic, strong) UISearchBar *searchBar; 18 | @property (nonatomic, strong) LLSearchView *searchView; 19 | @property (nonatomic, strong) NSMutableArray *hotArray; 20 | @property (nonatomic, strong) NSMutableArray *historyArray; 21 | @property (nonatomic, strong) LLSearchSuggestionVC *searchSuggestVC; 22 | 23 | @end 24 | 25 | @implementation LLSearchViewController 26 | 27 | - (NSMutableArray *)hotArray 28 | { 29 | if (!_hotArray) { 30 | self.hotArray = [NSMutableArray arrayWithObjects:@"悦诗风吟", @"洗面奶", @"兰芝", @"面膜", @"篮球鞋", @"阿迪达斯", @"耐克", @"运动鞋", nil]; 31 | } 32 | return _hotArray; 33 | } 34 | 35 | - (NSMutableArray *)historyArray 36 | { 37 | if (!_historyArray) { 38 | _historyArray = [NSKeyedUnarchiver unarchiveObjectWithFile:KHistorySearchPath]; 39 | if (!_historyArray) { 40 | self.historyArray = [NSMutableArray array]; 41 | } 42 | } 43 | return _historyArray; 44 | } 45 | 46 | 47 | - (LLSearchView *)searchView 48 | { 49 | if (!_searchView) { 50 | self.searchView = [[LLSearchView alloc] initWithFrame:CGRectMake(0, 64, KScreenWidth, KScreenHeight - 64) hotArray:self.hotArray historyArray:self.historyArray]; 51 | __weak LLSearchViewController *weakSelf = self; 52 | _searchView.tapAction = ^(NSString *str) { 53 | [weakSelf pushToSearchResultWithSearchStr:str]; 54 | }; 55 | } 56 | return _searchView; 57 | } 58 | 59 | 60 | - (LLSearchSuggestionVC *)searchSuggestVC 61 | { 62 | if (!_searchSuggestVC) { 63 | self.searchSuggestVC = [[LLSearchSuggestionVC alloc] init]; 64 | _searchSuggestVC.view.frame = CGRectMake(0, 64, KScreenWidth, KScreenHeight - 64); 65 | _searchSuggestVC.view.hidden = YES; 66 | __weak LLSearchViewController *weakSelf = self; 67 | _searchSuggestVC.searchBlock = ^(NSString *searchTest) { 68 | [weakSelf pushToSearchResultWithSearchStr:searchTest]; 69 | }; 70 | } 71 | return _searchSuggestVC; 72 | } 73 | 74 | 75 | 76 | - (void)viewDidAppear:(BOOL)animated 77 | { 78 | [super viewDidAppear:animated]; 79 | if (!_searchBar.isFirstResponder) { 80 | [self.searchBar becomeFirstResponder]; 81 | } 82 | } 83 | 84 | - (void)viewWillDisappear:(BOOL)animated 85 | { 86 | [super viewWillDisappear:animated]; 87 | // 回收键盘 88 | [self.searchBar resignFirstResponder]; 89 | _searchSuggestVC.view.hidden = YES; 90 | } 91 | 92 | 93 | - (void)viewDidLoad 94 | { 95 | [super viewDidLoad]; 96 | [self setBarButtonItem]; 97 | self.view.backgroundColor = [UIColor whiteColor]; 98 | [self.view addSubview:self.searchView]; 99 | [self.view addSubview:self.searchSuggestVC.view]; 100 | [self addChildViewController:_searchSuggestVC]; 101 | } 102 | 103 | 104 | - (void)setBarButtonItem 105 | { 106 | [self.navigationItem setHidesBackButton:YES]; 107 | // 创建搜索框 108 | UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(5, 7, self.view.frame.size.width, 30)]; 109 | UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(titleView.frame) - 15, 30)]; 110 | searchBar.placeholder = @"搜索内容"; 111 | searchBar.backgroundImage = [UIImage imageNamed:@"clearImage"]; 112 | searchBar.delegate = self; 113 | searchBar.showsCancelButton = YES; 114 | UIView *searchTextField = searchTextField = [searchBar valueForKey:@"_searchField"]; 115 | searchTextField.backgroundColor = [UIColor colorWithRed:234/255.0 green:235/255.0 blue:237/255.0 alpha:1]; 116 | [searchBar setImage:[UIImage imageNamed:@"sort_magnifier"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal]; 117 | UIButton *cancleBtn = [searchBar valueForKey:@"cancelButton"]; 118 | //修改标题和标题颜色 119 | [cancleBtn setTitle:@"取消" forState:UIControlStateNormal]; 120 | [cancleBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 121 | 122 | [titleView addSubview:searchBar]; 123 | self.searchBar = searchBar; 124 | [self.searchBar becomeFirstResponder]; 125 | self.navigationItem.titleView = titleView; 126 | 127 | self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:nil]; 128 | } 129 | 130 | 131 | - (void)presentVCFirstBackClick:(UIButton *)sender 132 | { 133 | [self.navigationController popViewControllerAnimated:YES]; 134 | } 135 | 136 | 137 | /** 点击取消 */ 138 | - (void)cancelDidClick 139 | { 140 | [self.searchBar resignFirstResponder]; 141 | 142 | [self dismissViewControllerAnimated:NO completion:nil]; 143 | } 144 | 145 | 146 | - (void)pushToSearchResultWithSearchStr:(NSString *)str 147 | { 148 | self.searchBar.text = str; 149 | LLSearchResultViewController *searchResultVC = [[LLSearchResultViewController alloc] init]; 150 | searchResultVC.searchStr = str; 151 | searchResultVC.hotArray = _hotArray; 152 | searchResultVC.historyArray = _historyArray; 153 | [self.navigationController pushViewController:searchResultVC animated:YES]; 154 | [self setHistoryArrWithStr:str]; 155 | } 156 | 157 | - (void)setHistoryArrWithStr:(NSString *)str 158 | { 159 | for (int i = 0; i < _historyArray.count; i++) { 160 | if ([_historyArray[i] isEqualToString:str]) { 161 | [_historyArray removeObjectAtIndex:i]; 162 | break; 163 | } 164 | } 165 | [_historyArray insertObject:str atIndex:0]; 166 | [NSKeyedArchiver archiveRootObject:_historyArray toFile:KHistorySearchPath]; 167 | } 168 | 169 | 170 | #pragma mark - UISearchBarDelegate - 171 | 172 | 173 | - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar 174 | { 175 | [self pushToSearchResultWithSearchStr:searchBar.text]; 176 | } 177 | 178 | 179 | - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar 180 | { 181 | [self.searchBar resignFirstResponder]; 182 | [self.navigationController popViewControllerAnimated:YES]; 183 | } 184 | 185 | - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar 186 | { 187 | searchBar.showsCancelButton = YES; 188 | } 189 | 190 | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText 191 | { 192 | if (searchBar.text == nil || [searchBar.text length] <= 0) { 193 | _searchSuggestVC.view.hidden = YES; 194 | [self.view bringSubviewToFront:_searchView]; 195 | } else { 196 | _searchSuggestVC.view.hidden = NO; 197 | [self.view bringSubviewToFront:_searchSuggestVC.view]; 198 | [_searchSuggestVC searchTestChangeWithTest:searchBar.text]; 199 | } 200 | } 201 | 202 | - (void)didReceiveMemoryWarning 203 | { 204 | [super didReceiveMemoryWarning]; 205 | // Dispose of any resources that can be recreated. 206 | } 207 | 208 | /* 209 | #pragma mark - Navigation 210 | 211 | // In a storyboard-based application, you will often want to do a little preparation before navigation 212 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 213 | // Get the new view controller using [segue destinationViewController]. 214 | // Pass the selected object to the new view controller. 215 | } 216 | */ 217 | 218 | @end 219 | -------------------------------------------------------------------------------- /LLSearchView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LLSearchView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LLSearchViewController.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | self.title = @"搜索"; 22 | 23 | UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 24 | rightBtn.frame = CGRectMake(0, 0, 44, 44); 25 | [rightBtn setImage:[UIImage imageNamed:@"Home_Search"] forState:UIControlStateNormal]; 26 | [rightBtn addTarget:self action:@selector(searchAction:) forControlEvents:UIControlEventTouchUpInside]; 27 | UIBarButtonItem *rightBtnItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn]; 28 | self.navigationItem.rightBarButtonItem = rightBtnItem; 29 | self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:nil]; 30 | 31 | } 32 | 33 | - (void)searchAction:(UIButton *)sender 34 | { 35 | LLSearchViewController *seachVC = [[LLSearchViewController alloc] init]; 36 | [self.navigationController pushViewController:seachVC animated:YES]; 37 | } 38 | 39 | 40 | - (void)didReceiveMemoryWarning { 41 | [super didReceiveMemoryWarning]; 42 | // Dispose of any resources that can be recreated. 43 | } 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /LLSearchView/leftImage220.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/leftImage220.jpg -------------------------------------------------------------------------------- /LLSearchView/leftImage345.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/leftImage345.jpg -------------------------------------------------------------------------------- /LLSearchView/leftImage576.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/leftImage576.jpg -------------------------------------------------------------------------------- /LLSearchView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LLSearchView 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LLSearchView/rightImage220.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/rightImage220.jpg -------------------------------------------------------------------------------- /LLSearchView/rightImage345.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/rightImage345.jpg -------------------------------------------------------------------------------- /LLSearchView/rightImage576.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/LLSearchView/rightImage576.jpg -------------------------------------------------------------------------------- /LLSearchViewUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LLSearchViewUITests/LLSearchViewUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LLSearchViewUITests.m 3 | // LLSearchViewUITests 4 | // 5 | // Created by 王龙龙 on 2017/7/25. 6 | // Copyright © 2017年 王龙龙. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LLSearchViewUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LLSearchViewUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LLSearchView 2 | 搜索交互控件的简单封装,代码比较简单,没有做太多注释,希望对你有帮助,如果你有好的欢迎你给我交流,谢谢 3 | 4 | 5 | ![image](https://github.com/Running2snail/LLSearchView/blob/master/搜索1.gif) ![image](https://github.com/Running2snail/LLSearchView/blob/master/搜索.gif)   6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /搜索.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/搜索.gif -------------------------------------------------------------------------------- /搜索1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Running2snail/LLSearchView/9693c7a8bb6ceeedcd64d5bbec0023406a0401e5/搜索1.gif --------------------------------------------------------------------------------