├── LZSearchController ├── LZSearchController.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── Artron_LQQ.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── Artron_LQQ.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── LZSearchController.xcscheme │ │ └── xcschememanagement.plist ├── LZSearchController │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── LZSearchController │ │ ├── LZResultDisplayController.h │ │ ├── LZResultDisplayController.m │ │ ├── LZSearchController.h │ │ └── LZSearchController.m │ ├── SearchController+CustomNavBar │ │ ├── LZCustomViewController.h │ │ └── LZCustomViewController.m │ ├── SearchController+UINavigation │ │ ├── LZViewController.h │ │ └── LZViewController.m │ ├── UISearchBar │ │ ├── 40fe711f9b754b596159f3a6.jpg │ │ ├── 9c16fdfaaf51f3de3b5b8e0d94eef01f3b2979e9.jpg │ │ ├── MoreExpressionShops@3x.png │ │ ├── UISearchBarTest.h │ │ ├── UISearchBarTest.m │ │ └── aaaaa.png │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── LZSearchControllerUITests │ ├── Info.plist │ └── LZSearchControllerUITests.m └── README.md /LZSearchController/LZSearchController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 912E68701E07AEEA00147EC9 /* LZViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 912E686F1E07AEEA00147EC9 /* LZViewController.m */; }; 11 | 912E68771E07D79000147EC9 /* LZCustomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 912E68761E07D79000147EC9 /* LZCustomViewController.m */; }; 12 | 914DBD161E05483100A0DB08 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 914DBD151E05483100A0DB08 /* main.m */; }; 13 | 914DBD191E05483100A0DB08 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 914DBD181E05483100A0DB08 /* AppDelegate.m */; }; 14 | 914DBD1C1E05483100A0DB08 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 914DBD1B1E05483100A0DB08 /* ViewController.m */; }; 15 | 914DBD1F1E05483100A0DB08 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 914DBD1D1E05483100A0DB08 /* Main.storyboard */; }; 16 | 914DBD211E05483100A0DB08 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 914DBD201E05483100A0DB08 /* Assets.xcassets */; }; 17 | 914DBD241E05483100A0DB08 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 914DBD221E05483100A0DB08 /* LaunchScreen.storyboard */; }; 18 | 914DBD2F1E05483100A0DB08 /* LZSearchControllerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 914DBD2E1E05483100A0DB08 /* LZSearchControllerUITests.m */; }; 19 | 914DBD3F1E0548E500A0DB08 /* LZSearchController.m in Sources */ = {isa = PBXBuildFile; fileRef = 914DBD3E1E0548E500A0DB08 /* LZSearchController.m */; }; 20 | 914DBD451E054AFF00A0DB08 /* LZResultDisplayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 914DBD441E054AFF00A0DB08 /* LZResultDisplayController.m */; }; 21 | 91BD5B671E08C1CD0044B43B /* UISearchBarTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 91BD5B661E08C1CD0044B43B /* UISearchBarTest.m */; }; 22 | 91BD5B691E092DE00044B43B /* 40fe711f9b754b596159f3a6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 91BD5B681E092DE00044B43B /* 40fe711f9b754b596159f3a6.jpg */; }; 23 | 91BD5B6B1E092F510044B43B /* 9c16fdfaaf51f3de3b5b8e0d94eef01f3b2979e9.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 91BD5B6A1E092F510044B43B /* 9c16fdfaaf51f3de3b5b8e0d94eef01f3b2979e9.jpg */; }; 24 | 91BD5B6D1E0931D50044B43B /* aaaaa.png in Resources */ = {isa = PBXBuildFile; fileRef = 91BD5B6C1E0931D50044B43B /* aaaaa.png */; }; 25 | 91BD5B6F1E0934190044B43B /* MoreExpressionShops@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 91BD5B6E1E0934190044B43B /* MoreExpressionShops@3x.png */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 914DBD2B1E05483100A0DB08 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 914DBD091E05483100A0DB08 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 914DBD101E05483100A0DB08; 34 | remoteInfo = LZSearchController; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 912E686E1E07AEEA00147EC9 /* LZViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LZViewController.h; sourceTree = ""; }; 40 | 912E686F1E07AEEA00147EC9 /* LZViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LZViewController.m; sourceTree = ""; }; 41 | 912E68751E07D79000147EC9 /* LZCustomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LZCustomViewController.h; sourceTree = ""; }; 42 | 912E68761E07D79000147EC9 /* LZCustomViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LZCustomViewController.m; sourceTree = ""; }; 43 | 914DBD111E05483100A0DB08 /* LZSearchController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LZSearchController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 914DBD151E05483100A0DB08 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 45 | 914DBD171E05483100A0DB08 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 914DBD181E05483100A0DB08 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 914DBD1A1E05483100A0DB08 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 48 | 914DBD1B1E05483100A0DB08 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 49 | 914DBD1E1E05483100A0DB08 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 914DBD201E05483100A0DB08 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 51 | 914DBD231E05483100A0DB08 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 52 | 914DBD251E05483100A0DB08 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 914DBD2A1E05483100A0DB08 /* LZSearchControllerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LZSearchControllerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 914DBD2E1E05483100A0DB08 /* LZSearchControllerUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LZSearchControllerUITests.m; sourceTree = ""; }; 55 | 914DBD301E05483100A0DB08 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 914DBD3D1E0548E500A0DB08 /* LZSearchController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LZSearchController.h; sourceTree = ""; }; 57 | 914DBD3E1E0548E500A0DB08 /* LZSearchController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LZSearchController.m; sourceTree = ""; }; 58 | 914DBD431E054AFF00A0DB08 /* LZResultDisplayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LZResultDisplayController.h; sourceTree = ""; }; 59 | 914DBD441E054AFF00A0DB08 /* LZResultDisplayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LZResultDisplayController.m; sourceTree = ""; }; 60 | 91BD5B651E08C1CD0044B43B /* UISearchBarTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UISearchBarTest.h; sourceTree = ""; }; 61 | 91BD5B661E08C1CD0044B43B /* UISearchBarTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UISearchBarTest.m; sourceTree = ""; }; 62 | 91BD5B681E092DE00044B43B /* 40fe711f9b754b596159f3a6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 40fe711f9b754b596159f3a6.jpg; sourceTree = ""; }; 63 | 91BD5B6A1E092F510044B43B /* 9c16fdfaaf51f3de3b5b8e0d94eef01f3b2979e9.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 9c16fdfaaf51f3de3b5b8e0d94eef01f3b2979e9.jpg; sourceTree = ""; }; 64 | 91BD5B6C1E0931D50044B43B /* aaaaa.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = aaaaa.png; sourceTree = ""; }; 65 | 91BD5B6E1E0934190044B43B /* MoreExpressionShops@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "MoreExpressionShops@3x.png"; sourceTree = ""; }; 66 | /* End PBXFileReference section */ 67 | 68 | /* Begin PBXFrameworksBuildPhase section */ 69 | 914DBD0E1E05483100A0DB08 /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | 914DBD271E05483100A0DB08 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 912E686D1E07AEAB00147EC9 /* SearchController+UINavigation */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 912E686E1E07AEEA00147EC9 /* LZViewController.h */, 90 | 912E686F1E07AEEA00147EC9 /* LZViewController.m */, 91 | ); 92 | path = "SearchController+UINavigation"; 93 | sourceTree = ""; 94 | }; 95 | 912E68741E07D2DA00147EC9 /* SearchController+CustomNavBar */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 912E68751E07D79000147EC9 /* LZCustomViewController.h */, 99 | 912E68761E07D79000147EC9 /* LZCustomViewController.m */, 100 | ); 101 | path = "SearchController+CustomNavBar"; 102 | sourceTree = ""; 103 | }; 104 | 914DBD081E05483100A0DB08 = { 105 | isa = PBXGroup; 106 | children = ( 107 | 914DBD131E05483100A0DB08 /* LZSearchController */, 108 | 914DBD2D1E05483100A0DB08 /* LZSearchControllerUITests */, 109 | 914DBD121E05483100A0DB08 /* Products */, 110 | ); 111 | sourceTree = ""; 112 | }; 113 | 914DBD121E05483100A0DB08 /* Products */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 914DBD111E05483100A0DB08 /* LZSearchController.app */, 117 | 914DBD2A1E05483100A0DB08 /* LZSearchControllerUITests.xctest */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | 914DBD131E05483100A0DB08 /* LZSearchController */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 91BD5B641E08C1B10044B43B /* UISearchBar */, 126 | 912E68741E07D2DA00147EC9 /* SearchController+CustomNavBar */, 127 | 912E686D1E07AEAB00147EC9 /* SearchController+UINavigation */, 128 | 914DBD391E05484300A0DB08 /* LZSearchController */, 129 | 914DBD171E05483100A0DB08 /* AppDelegate.h */, 130 | 914DBD181E05483100A0DB08 /* AppDelegate.m */, 131 | 914DBD1A1E05483100A0DB08 /* ViewController.h */, 132 | 914DBD1B1E05483100A0DB08 /* ViewController.m */, 133 | 914DBD1D1E05483100A0DB08 /* Main.storyboard */, 134 | 914DBD201E05483100A0DB08 /* Assets.xcassets */, 135 | 914DBD221E05483100A0DB08 /* LaunchScreen.storyboard */, 136 | 914DBD251E05483100A0DB08 /* Info.plist */, 137 | 914DBD141E05483100A0DB08 /* Supporting Files */, 138 | ); 139 | path = LZSearchController; 140 | sourceTree = ""; 141 | }; 142 | 914DBD141E05483100A0DB08 /* Supporting Files */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 914DBD151E05483100A0DB08 /* main.m */, 146 | ); 147 | name = "Supporting Files"; 148 | sourceTree = ""; 149 | }; 150 | 914DBD2D1E05483100A0DB08 /* LZSearchControllerUITests */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 914DBD2E1E05483100A0DB08 /* LZSearchControllerUITests.m */, 154 | 914DBD301E05483100A0DB08 /* Info.plist */, 155 | ); 156 | path = LZSearchControllerUITests; 157 | sourceTree = ""; 158 | }; 159 | 914DBD391E05484300A0DB08 /* LZSearchController */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 914DBD3D1E0548E500A0DB08 /* LZSearchController.h */, 163 | 914DBD3E1E0548E500A0DB08 /* LZSearchController.m */, 164 | 914DBD431E054AFF00A0DB08 /* LZResultDisplayController.h */, 165 | 914DBD441E054AFF00A0DB08 /* LZResultDisplayController.m */, 166 | ); 167 | path = LZSearchController; 168 | sourceTree = ""; 169 | }; 170 | 91BD5B641E08C1B10044B43B /* UISearchBar */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | 91BD5B6A1E092F510044B43B /* 9c16fdfaaf51f3de3b5b8e0d94eef01f3b2979e9.jpg */, 174 | 91BD5B681E092DE00044B43B /* 40fe711f9b754b596159f3a6.jpg */, 175 | 91BD5B6C1E0931D50044B43B /* aaaaa.png */, 176 | 91BD5B6E1E0934190044B43B /* MoreExpressionShops@3x.png */, 177 | 91BD5B651E08C1CD0044B43B /* UISearchBarTest.h */, 178 | 91BD5B661E08C1CD0044B43B /* UISearchBarTest.m */, 179 | ); 180 | path = UISearchBar; 181 | sourceTree = ""; 182 | }; 183 | /* End PBXGroup section */ 184 | 185 | /* Begin PBXNativeTarget section */ 186 | 914DBD101E05483100A0DB08 /* LZSearchController */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = 914DBD331E05483100A0DB08 /* Build configuration list for PBXNativeTarget "LZSearchController" */; 189 | buildPhases = ( 190 | 914DBD0D1E05483100A0DB08 /* Sources */, 191 | 914DBD0E1E05483100A0DB08 /* Frameworks */, 192 | 914DBD0F1E05483100A0DB08 /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | ); 198 | name = LZSearchController; 199 | productName = LZSearchController; 200 | productReference = 914DBD111E05483100A0DB08 /* LZSearchController.app */; 201 | productType = "com.apple.product-type.application"; 202 | }; 203 | 914DBD291E05483100A0DB08 /* LZSearchControllerUITests */ = { 204 | isa = PBXNativeTarget; 205 | buildConfigurationList = 914DBD361E05483100A0DB08 /* Build configuration list for PBXNativeTarget "LZSearchControllerUITests" */; 206 | buildPhases = ( 207 | 914DBD261E05483100A0DB08 /* Sources */, 208 | 914DBD271E05483100A0DB08 /* Frameworks */, 209 | 914DBD281E05483100A0DB08 /* Resources */, 210 | ); 211 | buildRules = ( 212 | ); 213 | dependencies = ( 214 | 914DBD2C1E05483100A0DB08 /* PBXTargetDependency */, 215 | ); 216 | name = LZSearchControllerUITests; 217 | productName = LZSearchControllerUITests; 218 | productReference = 914DBD2A1E05483100A0DB08 /* LZSearchControllerUITests.xctest */; 219 | productType = "com.apple.product-type.bundle.ui-testing"; 220 | }; 221 | /* End PBXNativeTarget section */ 222 | 223 | /* Begin PBXProject section */ 224 | 914DBD091E05483100A0DB08 /* Project object */ = { 225 | isa = PBXProject; 226 | attributes = { 227 | LastUpgradeCheck = 0820; 228 | ORGANIZATIONNAME = Artup; 229 | TargetAttributes = { 230 | 914DBD101E05483100A0DB08 = { 231 | CreatedOnToolsVersion = 8.2; 232 | DevelopmentTeam = 29BN9F9KNE; 233 | ProvisioningStyle = Automatic; 234 | }; 235 | 914DBD291E05483100A0DB08 = { 236 | CreatedOnToolsVersion = 8.2; 237 | ProvisioningStyle = Automatic; 238 | TestTargetID = 914DBD101E05483100A0DB08; 239 | }; 240 | }; 241 | }; 242 | buildConfigurationList = 914DBD0C1E05483100A0DB08 /* Build configuration list for PBXProject "LZSearchController" */; 243 | compatibilityVersion = "Xcode 3.2"; 244 | developmentRegion = English; 245 | hasScannedForEncodings = 0; 246 | knownRegions = ( 247 | en, 248 | Base, 249 | ); 250 | mainGroup = 914DBD081E05483100A0DB08; 251 | productRefGroup = 914DBD121E05483100A0DB08 /* Products */; 252 | projectDirPath = ""; 253 | projectRoot = ""; 254 | targets = ( 255 | 914DBD101E05483100A0DB08 /* LZSearchController */, 256 | 914DBD291E05483100A0DB08 /* LZSearchControllerUITests */, 257 | ); 258 | }; 259 | /* End PBXProject section */ 260 | 261 | /* Begin PBXResourcesBuildPhase section */ 262 | 914DBD0F1E05483100A0DB08 /* Resources */ = { 263 | isa = PBXResourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | 91BD5B6F1E0934190044B43B /* MoreExpressionShops@3x.png in Resources */, 267 | 91BD5B6D1E0931D50044B43B /* aaaaa.png in Resources */, 268 | 914DBD241E05483100A0DB08 /* LaunchScreen.storyboard in Resources */, 269 | 91BD5B691E092DE00044B43B /* 40fe711f9b754b596159f3a6.jpg in Resources */, 270 | 914DBD211E05483100A0DB08 /* Assets.xcassets in Resources */, 271 | 91BD5B6B1E092F510044B43B /* 9c16fdfaaf51f3de3b5b8e0d94eef01f3b2979e9.jpg in Resources */, 272 | 914DBD1F1E05483100A0DB08 /* Main.storyboard in Resources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | 914DBD281E05483100A0DB08 /* Resources */ = { 277 | isa = PBXResourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXResourcesBuildPhase section */ 284 | 285 | /* Begin PBXSourcesBuildPhase section */ 286 | 914DBD0D1E05483100A0DB08 /* Sources */ = { 287 | isa = PBXSourcesBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | 914DBD1C1E05483100A0DB08 /* ViewController.m in Sources */, 291 | 914DBD191E05483100A0DB08 /* AppDelegate.m in Sources */, 292 | 914DBD161E05483100A0DB08 /* main.m in Sources */, 293 | 912E68771E07D79000147EC9 /* LZCustomViewController.m in Sources */, 294 | 912E68701E07AEEA00147EC9 /* LZViewController.m in Sources */, 295 | 91BD5B671E08C1CD0044B43B /* UISearchBarTest.m in Sources */, 296 | 914DBD3F1E0548E500A0DB08 /* LZSearchController.m in Sources */, 297 | 914DBD451E054AFF00A0DB08 /* LZResultDisplayController.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | 914DBD261E05483100A0DB08 /* Sources */ = { 302 | isa = PBXSourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | 914DBD2F1E05483100A0DB08 /* LZSearchControllerUITests.m in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | /* End PBXSourcesBuildPhase section */ 310 | 311 | /* Begin PBXTargetDependency section */ 312 | 914DBD2C1E05483100A0DB08 /* PBXTargetDependency */ = { 313 | isa = PBXTargetDependency; 314 | target = 914DBD101E05483100A0DB08 /* LZSearchController */; 315 | targetProxy = 914DBD2B1E05483100A0DB08 /* PBXContainerItemProxy */; 316 | }; 317 | /* End PBXTargetDependency section */ 318 | 319 | /* Begin PBXVariantGroup section */ 320 | 914DBD1D1E05483100A0DB08 /* Main.storyboard */ = { 321 | isa = PBXVariantGroup; 322 | children = ( 323 | 914DBD1E1E05483100A0DB08 /* Base */, 324 | ); 325 | name = Main.storyboard; 326 | sourceTree = ""; 327 | }; 328 | 914DBD221E05483100A0DB08 /* LaunchScreen.storyboard */ = { 329 | isa = PBXVariantGroup; 330 | children = ( 331 | 914DBD231E05483100A0DB08 /* Base */, 332 | ); 333 | name = LaunchScreen.storyboard; 334 | sourceTree = ""; 335 | }; 336 | /* End PBXVariantGroup section */ 337 | 338 | /* Begin XCBuildConfiguration section */ 339 | 914DBD311E05483100A0DB08 /* Debug */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ALWAYS_SEARCH_USER_PATHS = NO; 343 | CLANG_ANALYZER_NONNULL = YES; 344 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 345 | CLANG_CXX_LIBRARY = "libc++"; 346 | CLANG_ENABLE_MODULES = YES; 347 | CLANG_ENABLE_OBJC_ARC = YES; 348 | CLANG_WARN_BOOL_CONVERSION = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 351 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 352 | CLANG_WARN_EMPTY_BODY = YES; 353 | CLANG_WARN_ENUM_CONVERSION = YES; 354 | CLANG_WARN_INFINITE_RECURSION = YES; 355 | CLANG_WARN_INT_CONVERSION = YES; 356 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 357 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = NO; 362 | DEBUG_INFORMATION_FORMAT = dwarf; 363 | ENABLE_STRICT_OBJC_MSGSEND = YES; 364 | ENABLE_TESTABILITY = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_DYNAMIC_NO_PIC = NO; 367 | GCC_NO_COMMON_BLOCKS = YES; 368 | GCC_OPTIMIZATION_LEVEL = 0; 369 | GCC_PREPROCESSOR_DEFINITIONS = ( 370 | "DEBUG=1", 371 | "$(inherited)", 372 | ); 373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 375 | GCC_WARN_UNDECLARED_SELECTOR = YES; 376 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 377 | GCC_WARN_UNUSED_FUNCTION = YES; 378 | GCC_WARN_UNUSED_VARIABLE = YES; 379 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 380 | MTL_ENABLE_DEBUG_INFO = YES; 381 | ONLY_ACTIVE_ARCH = YES; 382 | SDKROOT = iphoneos; 383 | TARGETED_DEVICE_FAMILY = "1,2"; 384 | }; 385 | name = Debug; 386 | }; 387 | 914DBD321E05483100A0DB08 /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_ANALYZER_NONNULL = YES; 392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 393 | CLANG_CXX_LIBRARY = "libc++"; 394 | CLANG_ENABLE_MODULES = YES; 395 | CLANG_ENABLE_OBJC_ARC = YES; 396 | CLANG_WARN_BOOL_CONVERSION = YES; 397 | CLANG_WARN_CONSTANT_CONVERSION = YES; 398 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 399 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 400 | CLANG_WARN_EMPTY_BODY = YES; 401 | CLANG_WARN_ENUM_CONVERSION = YES; 402 | CLANG_WARN_INFINITE_RECURSION = YES; 403 | CLANG_WARN_INT_CONVERSION = YES; 404 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 405 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 406 | CLANG_WARN_UNREACHABLE_CODE = YES; 407 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 408 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 409 | COPY_PHASE_STRIP = NO; 410 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 411 | ENABLE_NS_ASSERTIONS = NO; 412 | ENABLE_STRICT_OBJC_MSGSEND = YES; 413 | GCC_C_LANGUAGE_STANDARD = gnu99; 414 | GCC_NO_COMMON_BLOCKS = YES; 415 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 416 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 417 | GCC_WARN_UNDECLARED_SELECTOR = YES; 418 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 419 | GCC_WARN_UNUSED_FUNCTION = YES; 420 | GCC_WARN_UNUSED_VARIABLE = YES; 421 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 422 | MTL_ENABLE_DEBUG_INFO = NO; 423 | SDKROOT = iphoneos; 424 | TARGETED_DEVICE_FAMILY = "1,2"; 425 | VALIDATE_PRODUCT = YES; 426 | }; 427 | name = Release; 428 | }; 429 | 914DBD341E05483100A0DB08 /* Debug */ = { 430 | isa = XCBuildConfiguration; 431 | buildSettings = { 432 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 433 | DEVELOPMENT_TEAM = 29BN9F9KNE; 434 | INFOPLIST_FILE = LZSearchController/Info.plist; 435 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 436 | PRODUCT_BUNDLE_IDENTIFIER = com.artup.LZSearchController; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | }; 439 | name = Debug; 440 | }; 441 | 914DBD351E05483100A0DB08 /* Release */ = { 442 | isa = XCBuildConfiguration; 443 | buildSettings = { 444 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 445 | DEVELOPMENT_TEAM = 29BN9F9KNE; 446 | INFOPLIST_FILE = LZSearchController/Info.plist; 447 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 448 | PRODUCT_BUNDLE_IDENTIFIER = com.artup.LZSearchController; 449 | PRODUCT_NAME = "$(TARGET_NAME)"; 450 | }; 451 | name = Release; 452 | }; 453 | 914DBD371E05483100A0DB08 /* Debug */ = { 454 | isa = XCBuildConfiguration; 455 | buildSettings = { 456 | INFOPLIST_FILE = LZSearchControllerUITests/Info.plist; 457 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 458 | PRODUCT_BUNDLE_IDENTIFIER = com.artup.LZSearchControllerUITests; 459 | PRODUCT_NAME = "$(TARGET_NAME)"; 460 | TEST_TARGET_NAME = LZSearchController; 461 | }; 462 | name = Debug; 463 | }; 464 | 914DBD381E05483100A0DB08 /* Release */ = { 465 | isa = XCBuildConfiguration; 466 | buildSettings = { 467 | INFOPLIST_FILE = LZSearchControllerUITests/Info.plist; 468 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 469 | PRODUCT_BUNDLE_IDENTIFIER = com.artup.LZSearchControllerUITests; 470 | PRODUCT_NAME = "$(TARGET_NAME)"; 471 | TEST_TARGET_NAME = LZSearchController; 472 | }; 473 | name = Release; 474 | }; 475 | /* End XCBuildConfiguration section */ 476 | 477 | /* Begin XCConfigurationList section */ 478 | 914DBD0C1E05483100A0DB08 /* Build configuration list for PBXProject "LZSearchController" */ = { 479 | isa = XCConfigurationList; 480 | buildConfigurations = ( 481 | 914DBD311E05483100A0DB08 /* Debug */, 482 | 914DBD321E05483100A0DB08 /* Release */, 483 | ); 484 | defaultConfigurationIsVisible = 0; 485 | defaultConfigurationName = Release; 486 | }; 487 | 914DBD331E05483100A0DB08 /* Build configuration list for PBXNativeTarget "LZSearchController" */ = { 488 | isa = XCConfigurationList; 489 | buildConfigurations = ( 490 | 914DBD341E05483100A0DB08 /* Debug */, 491 | 914DBD351E05483100A0DB08 /* Release */, 492 | ); 493 | defaultConfigurationIsVisible = 0; 494 | defaultConfigurationName = Release; 495 | }; 496 | 914DBD361E05483100A0DB08 /* Build configuration list for PBXNativeTarget "LZSearchControllerUITests" */ = { 497 | isa = XCConfigurationList; 498 | buildConfigurations = ( 499 | 914DBD371E05483100A0DB08 /* Debug */, 500 | 914DBD381E05483100A0DB08 /* Release */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | /* End XCConfigurationList section */ 506 | }; 507 | rootObject = 914DBD091E05483100A0DB08 /* Project object */; 508 | } 509 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController.xcodeproj/project.xcworkspace/xcuserdata/Artron_LQQ.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qrices/LSearchController/8bfa7051089f3d5d3cba1399713e156b55e2d16a/LZSearchController/LZSearchController.xcodeproj/project.xcworkspace/xcuserdata/Artron_LQQ.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LZSearchController/LZSearchController.xcodeproj/xcuserdata/Artron_LQQ.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController.xcodeproj/xcuserdata/Artron_LQQ.xcuserdatad/xcschemes/LZSearchController.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 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController.xcodeproj/xcuserdata/Artron_LQQ.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LZSearchController.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 914DBD101E05483100A0DB08 16 | 17 | primary 18 | 19 | 20 | 914DBD291E05483100A0DB08 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/17. 6 | // Copyright © 2016年 Artup. 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 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/17. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | 22 | ViewController *view = [[ViewController alloc]init]; 23 | 24 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:view]; 25 | self.window.rootViewController = nav; 26 | return YES; 27 | } 28 | 29 | 30 | - (void)applicationWillResignActive:(UIApplication *)application { 31 | // 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. 32 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 33 | } 34 | 35 | 36 | - (void)applicationDidEnterBackground:(UIApplication *)application { 37 | // 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. 38 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 39 | } 40 | 41 | 42 | - (void)applicationWillEnterForeground:(UIApplication *)application { 43 | // 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. 44 | } 45 | 46 | 47 | - (void)applicationDidBecomeActive:(UIApplication *)application { 48 | // 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. 49 | } 50 | 51 | 52 | - (void)applicationWillTerminate:(UIApplication *)application { 53 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 54 | } 55 | 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/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 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/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 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/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 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/LZSearchController/LZResultDisplayController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LZResultDisplayController.h 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/17. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LZResultDisplayController : UITableViewController 12 | 13 | @property (nonatomic, strong) NSMutableArray *datas; 14 | @end 15 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/LZSearchController/LZResultDisplayController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LZResultDisplayController.m 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/17. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import "LZResultDisplayController.h" 10 | 11 | @interface LZResultDisplayController () 12 | 13 | @property (nonatomic, strong) NSMutableArray *results; 14 | @end 15 | 16 | @implementation LZResultDisplayController 17 | 18 | - (NSMutableArray *)results { 19 | if (_results == nil) { 20 | _results = [NSMutableArray arrayWithCapacity:0]; 21 | } 22 | 23 | return _results; 24 | } 25 | 26 | 27 | - (void)viewDidLoad { 28 | [super viewDidLoad]; 29 | 30 | // Uncomment the following line to preserve selection between presentations. 31 | // self.clearsSelectionOnViewWillAppear = NO; 32 | 33 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 34 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 35 | 36 | self.tableView.backgroundColor = [UIColor greenColor]; 37 | 38 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"resultCell"]; 39 | } 40 | 41 | - (void)didReceiveMemoryWarning { 42 | [super didReceiveMemoryWarning]; 43 | // Dispose of any resources that can be recreated. 44 | } 45 | 46 | #pragma mark - Table view data source 47 | 48 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 49 | 50 | return 1; 51 | } 52 | 53 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 54 | 55 | return self.results.count; 56 | } 57 | 58 | 59 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 60 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"resultCell" forIndexPath:indexPath]; 61 | 62 | // Configure the cell... 63 | 64 | cell.textLabel.text = [self.results objectAtIndex:indexPath.row]; 65 | return cell; 66 | } 67 | 68 | 69 | - (void)updateSearchResultsForSearchController:(UISearchController *)searchController { 70 | 71 | NSString *inputStr = searchController.searchBar.text ; 72 | if (self.results.count > 0) { 73 | [self.results removeAllObjects]; 74 | } 75 | for (NSString *str in self.datas) { 76 | 77 | if ([str.lowercaseString rangeOfString:inputStr.lowercaseString].location != NSNotFound) { 78 | 79 | [self.results addObject:str]; 80 | } 81 | } 82 | 83 | [self.tableView reloadData]; 84 | } 85 | /* 86 | // Override to support conditional editing of the table view. 87 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 88 | // Return NO if you do not want the specified item to be editable. 89 | return YES; 90 | } 91 | */ 92 | 93 | /* 94 | // Override to support editing the table view. 95 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 96 | if (editingStyle == UITableViewCellEditingStyleDelete) { 97 | // Delete the row from the data source 98 | [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 99 | } else if (editingStyle == UITableViewCellEditingStyleInsert) { 100 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view 101 | } 102 | } 103 | */ 104 | 105 | /* 106 | // Override to support rearranging the table view. 107 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { 108 | } 109 | */ 110 | 111 | /* 112 | // Override to support conditional rearranging of the table view. 113 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { 114 | // Return NO if you do not want the item to be re-orderable. 115 | return YES; 116 | } 117 | */ 118 | 119 | /* 120 | #pragma mark - Navigation 121 | 122 | // In a storyboard-based application, you will often want to do a little preparation before navigation 123 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 124 | // Get the new view controller using [segue destinationViewController]. 125 | // Pass the selected object to the new view controller. 126 | } 127 | */ 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/LZSearchController/LZSearchController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LZSearchController.h 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/17. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LZSearchController : UITableViewController 12 | 13 | @property (nonatomic, strong) NSMutableArray *datas; 14 | @end 15 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/LZSearchController/LZSearchController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LZSearchController.m 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/17. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import "LZSearchController.h" 10 | #import "LZResultDisplayController.h" 11 | 12 | @interface LZSearchController () 13 | 14 | @property (nonatomic, strong) LZResultDisplayController *displayController; 15 | @property (nonatomic, strong) UISearchController *searchController; 16 | ; 17 | @end 18 | 19 | @implementation LZSearchController 20 | - (NSMutableArray *)datas { 21 | if (_datas == nil) { 22 | _datas = [NSMutableArray arrayWithCapacity:0]; 23 | } 24 | 25 | return _datas; 26 | } 27 | 28 | - (void)viewDidLoad { 29 | [super viewDidLoad]; 30 | 31 | for (int i = 0; i < 100; i++) { 32 | 33 | NSString *str = [NSString stringWithFormat:@"测试数据%d", i]; 34 | 35 | [self.datas addObject:str]; 36 | } 37 | 38 | // 创建用于展示搜索结果的控制器 39 | LZResultDisplayController *result = [[LZResultDisplayController alloc]init]; 40 | result.datas = [self.datas copy]; 41 | 42 | // 创建搜索框 43 | UISearchController *search = [[UISearchController alloc]initWithSearchResultsController:result]; 44 | 45 | self.tableView.tableHeaderView = search.searchBar; 46 | 47 | search.searchResultsUpdater = result; 48 | 49 | self.searchController = search; 50 | //是否添加半透明覆盖层 51 | // search.dimsBackgroundDuringPresentation = YES; 52 | // //是否隐藏导航栏 53 | // search.hidesNavigationBarDuringPresentation = YES; 54 | 55 | // self.definesPresentationContext = YES; 56 | 57 | search.searchBar.placeholder = @"搜索"; 58 | 59 | // self.definesPresentationContext = YES; 60 | // search.searchBar.delegate = self; 61 | 62 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:NSStringFromClass([UITableViewCell class])]; 63 | 64 | } 65 | 66 | 67 | - (void)didReceiveMemoryWarning { 68 | [super didReceiveMemoryWarning]; 69 | // Dispose of any resources that can be recreated. 70 | 71 | 72 | 73 | } 74 | 75 | #pragma mark - Table view data source 76 | 77 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 78 | 79 | return 1; 80 | } 81 | 82 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 83 | 84 | return self.datas.count; 85 | } 86 | 87 | 88 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 89 | 90 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class]) forIndexPath:indexPath]; 91 | 92 | cell.textLabel.text = [self.datas objectAtIndex:indexPath.row]; 93 | return cell; 94 | } 95 | 96 | 97 | /* 98 | // Override to support conditional editing of the table view. 99 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 100 | // Return NO if you do not want the specified item to be editable. 101 | return YES; 102 | } 103 | */ 104 | 105 | /* 106 | // Override to support editing the table view. 107 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 108 | if (editingStyle == UITableViewCellEditingStyleDelete) { 109 | // Delete the row from the data source 110 | [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 111 | } else if (editingStyle == UITableViewCellEditingStyleInsert) { 112 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view 113 | } 114 | } 115 | */ 116 | 117 | /* 118 | // Override to support rearranging the table view. 119 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { 120 | } 121 | */ 122 | 123 | /* 124 | // Override to support conditional rearranging of the table view. 125 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { 126 | // Return NO if you do not want the item to be re-orderable. 127 | return YES; 128 | } 129 | */ 130 | 131 | /* 132 | #pragma mark - Navigation 133 | 134 | // In a storyboard-based application, you will often want to do a little preparation before navigation 135 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 136 | // Get the new view controller using [segue destinationViewController]. 137 | // Pass the selected object to the new view controller. 138 | } 139 | */ 140 | 141 | @end 142 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/SearchController+CustomNavBar/LZCustomViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LZCustomViewController.h 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/19. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LZCustomViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/SearchController+CustomNavBar/LZCustomViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LZCustomViewController.m 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/19. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import "LZCustomViewController.h" 10 | 11 | @interface LZCustomViewController () 12 | 13 | @property (nonatomic, strong) UITableView *tableView; 14 | @property (nonatomic, strong) UISearchController *searchController; 15 | @property (nonatomic, strong) NSMutableArray *datas; 16 | @property (nonatomic, strong) NSMutableArray *results; 17 | @property (nonatomic, strong) UIView *customNavBar; 18 | @end 19 | 20 | @implementation LZCustomViewController 21 | - (UITableView *)tableView { 22 | if (_tableView == nil) { 23 | _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 64, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame) - 64) style:UITableViewStylePlain]; 24 | _tableView.delegate = self; 25 | _tableView.dataSource = self; 26 | [self.view addSubview:_tableView]; 27 | } 28 | 29 | return _tableView; 30 | } 31 | 32 | - (NSMutableArray *)datas { 33 | if (_datas == nil) { 34 | _datas = [NSMutableArray arrayWithCapacity:0]; 35 | } 36 | 37 | return _datas; 38 | } 39 | 40 | - (NSMutableArray *)results { 41 | if (_results == nil) { 42 | _results = [NSMutableArray arrayWithCapacity:0]; 43 | } 44 | 45 | return _results; 46 | } 47 | 48 | - (void)viewWillAppear:(BOOL)animated { 49 | [super viewWillAppear:animated]; 50 | 51 | if (self.navigationController) { 52 | 53 | self.navigationController.navigationBarHidden = YES; 54 | } 55 | } 56 | 57 | - (void)viewWillDisappear:(BOOL)animated { 58 | [super viewWillDisappear:animated]; 59 | 60 | if (self.navigationController) { 61 | self.navigationController.navigationBarHidden = NO; 62 | } 63 | } 64 | 65 | - (UIView *)customNavBar { 66 | if (_customNavBar == nil) { 67 | _customNavBar = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)]; 68 | _customNavBar.backgroundColor = [UIColor whiteColor]; 69 | 70 | [self.view addSubview:_customNavBar]; 71 | } 72 | 73 | return _customNavBar; 74 | } 75 | 76 | - (void)setupNavBar { 77 | 78 | UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 79 | backBtn.frame = CGRectMake(0, 20, 80, 44); 80 | [backBtn setTitle:@"返回" forState:UIControlStateNormal]; 81 | [backBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; 82 | [backBtn addTarget:self action:@selector(backBtnClick) forControlEvents:UIControlEventTouchUpInside]; 83 | [self.customNavBar addSubview:backBtn]; 84 | } 85 | 86 | - (void)backBtnClick { 87 | 88 | [self.navigationController popViewControllerAnimated:YES]; 89 | } 90 | 91 | - (void)viewDidLoad { 92 | [super viewDidLoad]; 93 | // Do any additional setup after loading the view. 94 | 95 | self.view.backgroundColor = [UIColor whiteColor]; 96 | 97 | [self setupNavBar]; 98 | 99 | for (int i = 0; i < 100; i++) { 100 | 101 | NSString *str = [NSString stringWithFormat:@"测试数据%d", i]; 102 | 103 | [self.datas addObject:str]; 104 | } 105 | 106 | // 创建UISearchController, 这里使用当前控制器来展示结果 107 | UISearchController *search = [[UISearchController alloc]initWithSearchResultsController:nil]; 108 | // 设置结果更新代理 109 | search.searchResultsUpdater = self; 110 | // 因为在当前控制器展示结果, 所以不需要这个透明视图 111 | search.dimsBackgroundDuringPresentation = NO; 112 | // 是否自动隐藏导航 113 | // search.hidesNavigationBarDuringPresentation = NO; 114 | self.searchController = search; 115 | // 将searchBar赋值给tableView的tableHeaderView 116 | self.tableView.tableHeaderView = search.searchBar; 117 | 118 | search.searchBar.delegate = self; 119 | } 120 | 121 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 122 | 123 | // 这里通过searchController的active属性来区分展示数据源是哪个 124 | if (self.searchController.active) { 125 | 126 | return self.results.count ; 127 | } 128 | 129 | return self.datas.count; 130 | } 131 | 132 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 133 | 134 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"]; 135 | if (cell == nil) { 136 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cellID"]; 137 | } 138 | 139 | // 这里通过searchController的active属性来区分展示数据源是哪个 140 | if (self.searchController.active ) { 141 | 142 | cell.textLabel.text = [self.results objectAtIndex:indexPath.row]; 143 | } else { 144 | 145 | cell.textLabel.text = [self.datas objectAtIndex:indexPath.row]; 146 | } 147 | 148 | return cell; 149 | } 150 | 151 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 152 | 153 | if (self.searchController.active) { 154 | NSLog(@"选择了搜索结果中的%@", [self.results objectAtIndex:indexPath.row]); 155 | } else { 156 | 157 | NSLog(@"选择了列表中的%@", [self.datas objectAtIndex:indexPath.row]); 158 | } 159 | 160 | } 161 | 162 | #pragma mark - UISearchResultsUpdating 163 | - (void)updateSearchResultsForSearchController:(UISearchController *)searchController { 164 | 165 | NSString *inputStr = searchController.searchBar.text ; 166 | if (self.results.count > 0) { 167 | [self.results removeAllObjects]; 168 | } 169 | for (NSString *str in self.datas) { 170 | 171 | if ([str.lowercaseString rangeOfString:inputStr.lowercaseString].location != NSNotFound) { 172 | 173 | [self.results addObject:str]; 174 | } 175 | } 176 | 177 | [self.tableView reloadData]; 178 | } 179 | 180 | #pragma mark - UISearchBarDelegate 181 | - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar{ 182 | 183 | 184 | return YES; 185 | } 186 | - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { 187 | 188 | CGRect barFrame = self.customNavBar.frame; 189 | // 移动到屏幕上方 190 | barFrame.origin.y = - 64; 191 | 192 | 193 | // 调整tableView的frame为全屏 194 | CGRect tableFrame = self.tableView.frame; 195 | tableFrame.origin.y = 20; 196 | tableFrame.size.height = self.view.frame.size.height -20; 197 | 198 | 199 | self.customNavBar.frame = barFrame; 200 | self.tableView.frame = tableFrame; 201 | [UIView animateWithDuration:0.4 animations:^{ 202 | 203 | [self.view layoutIfNeeded]; 204 | [self.tableView layoutIfNeeded]; 205 | }]; 206 | } 207 | - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar { 208 | 209 | 210 | return YES; 211 | } 212 | 213 | - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar { 214 | 215 | CGRect barFrame = self.customNavBar.frame; 216 | // 恢复 217 | barFrame.origin.y = 0; 218 | 219 | 220 | // 调整tableView的frame为全屏 221 | CGRect tableFrame = self.tableView.frame; 222 | tableFrame.origin.y = 64; 223 | tableFrame.size.height = self.view.frame.size.height - 64; 224 | 225 | 226 | [UIView animateWithDuration:0.4 animations:^{ 227 | 228 | self.customNavBar.frame = barFrame; 229 | self.tableView.frame = tableFrame; 230 | }]; 231 | } 232 | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { 233 | 234 | } 235 | 236 | - (void)didReceiveMemoryWarning { 237 | [super didReceiveMemoryWarning]; 238 | // Dispose of any resources that can be recreated. 239 | } 240 | 241 | /* 242 | #pragma mark - Navigation 243 | 244 | // In a storyboard-based application, you will often want to do a little preparation before navigation 245 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 246 | // Get the new view controller using [segue destinationViewController]. 247 | // Pass the selected object to the new view controller. 248 | } 249 | */ 250 | 251 | @end 252 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/SearchController+UINavigation/LZViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LZViewController.h 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/19. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LZViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/SearchController+UINavigation/LZViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LZViewController.m 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/19. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import "LZViewController.h" 10 | 11 | @interface LZViewController () 12 | 13 | @property (nonatomic, strong) UITableView *tableView; 14 | @property (nonatomic, strong) UISearchController *searchController; 15 | @property (nonatomic, strong) NSMutableArray *datas; 16 | @property (nonatomic, strong) NSMutableArray *results; 17 | @end 18 | 19 | @implementation LZViewController 20 | - (UITableView *)tableView { 21 | if (_tableView == nil) { 22 | _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain]; 23 | _tableView.delegate = self; 24 | _tableView.dataSource = self; 25 | [self.view addSubview:_tableView]; 26 | } 27 | 28 | return _tableView; 29 | } 30 | 31 | - (NSMutableArray *)datas { 32 | if (_datas == nil) { 33 | _datas = [NSMutableArray arrayWithCapacity:0]; 34 | } 35 | 36 | return _datas; 37 | } 38 | 39 | - (NSMutableArray *)results { 40 | if (_results == nil) { 41 | _results = [NSMutableArray arrayWithCapacity:0]; 42 | } 43 | 44 | return _results; 45 | } 46 | 47 | - (void)viewDidLoad { 48 | [super viewDidLoad]; 49 | // Do any additional setup after loading the view. 50 | 51 | self.view.backgroundColor = [UIColor whiteColor]; 52 | 53 | 54 | for (int i = 0; i < 100; i++) { 55 | 56 | NSString *str = [NSString stringWithFormat:@"测试数据%d", i]; 57 | 58 | [self.datas addObject:str]; 59 | } 60 | 61 | // 创建UISearchController, 这里使用当前控制器来展示结果 62 | UISearchController *search = [[UISearchController alloc]initWithSearchResultsController:nil]; 63 | // 设置结果更新代理 64 | search.searchResultsUpdater = self; 65 | // 因为在当前控制器展示结果, 所以不需要这个透明视图 66 | search.dimsBackgroundDuringPresentation = NO; 67 | // 是否自动隐藏导航 68 | // search.hidesNavigationBarDuringPresentation = NO; 69 | self.searchController = search; 70 | // 将searchBar赋值给tableView的tableHeaderView 71 | self.tableView.tableHeaderView = search.searchBar; 72 | 73 | search.searchBar.delegate = self; 74 | } 75 | 76 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 77 | 78 | // 这里通过searchController的active属性来区分展示数据源是哪个 79 | if (self.searchController.active) { 80 | 81 | return self.results.count ; 82 | } 83 | 84 | return self.datas.count; 85 | } 86 | 87 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 88 | 89 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"]; 90 | if (cell == nil) { 91 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cellID"]; 92 | } 93 | 94 | // 这里通过searchController的active属性来区分展示数据源是哪个 95 | if (self.searchController.active ) { 96 | 97 | cell.textLabel.text = [self.results objectAtIndex:indexPath.row]; 98 | } else { 99 | 100 | cell.textLabel.text = [self.datas objectAtIndex:indexPath.row]; 101 | } 102 | 103 | return cell; 104 | } 105 | 106 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 107 | 108 | if (self.searchController.active) { 109 | NSLog(@"选择了搜索结果中的%@", [self.results objectAtIndex:indexPath.row]); 110 | } else { 111 | 112 | NSLog(@"选择了列表中的%@", [self.datas objectAtIndex:indexPath.row]); 113 | } 114 | 115 | } 116 | 117 | #pragma mark - UISearchResultsUpdating 118 | - (void)updateSearchResultsForSearchController:(UISearchController *)searchController { 119 | 120 | NSString *inputStr = searchController.searchBar.text ; 121 | if (self.results.count > 0) { 122 | [self.results removeAllObjects]; 123 | } 124 | for (NSString *str in self.datas) { 125 | 126 | if ([str.lowercaseString rangeOfString:inputStr.lowercaseString].location != NSNotFound) { 127 | 128 | [self.results addObject:str]; 129 | } 130 | } 131 | 132 | [self.tableView reloadData]; 133 | } 134 | 135 | #pragma mark - UISearchBarDelegate 136 | - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar{ 137 | 138 | return YES; 139 | } 140 | - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { 141 | 142 | } 143 | - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar { 144 | 145 | return YES; 146 | } 147 | 148 | - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar { 149 | 150 | } 151 | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { 152 | 153 | } 154 | 155 | - (void)didReceiveMemoryWarning { 156 | [super didReceiveMemoryWarning]; 157 | // Dispose of any resources that can be recreated. 158 | } 159 | 160 | /* 161 | #pragma mark - Navigation 162 | 163 | // In a storyboard-based application, you will often want to do a little preparation before navigation 164 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 165 | // Get the new view controller using [segue destinationViewController]. 166 | // Pass the selected object to the new view controller. 167 | } 168 | */ 169 | 170 | @end 171 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/UISearchBar/40fe711f9b754b596159f3a6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qrices/LSearchController/8bfa7051089f3d5d3cba1399713e156b55e2d16a/LZSearchController/LZSearchController/UISearchBar/40fe711f9b754b596159f3a6.jpg -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/UISearchBar/9c16fdfaaf51f3de3b5b8e0d94eef01f3b2979e9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qrices/LSearchController/8bfa7051089f3d5d3cba1399713e156b55e2d16a/LZSearchController/LZSearchController/UISearchBar/9c16fdfaaf51f3de3b5b8e0d94eef01f3b2979e9.jpg -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/UISearchBar/MoreExpressionShops@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qrices/LSearchController/8bfa7051089f3d5d3cba1399713e156b55e2d16a/LZSearchController/LZSearchController/UISearchBar/MoreExpressionShops@3x.png -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/UISearchBar/UISearchBarTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISearchBarTest.h 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/20. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UISearchBarTest : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/UISearchBar/UISearchBarTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // UISearchBarTest.m 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/20. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import "UISearchBarTest.h" 10 | 11 | @interface UISearchBarTest () 12 | 13 | @property (nonatomic, strong) UITableView *tableView; 14 | @property (nonatomic, strong) UISearchController *searchController; 15 | @end 16 | 17 | @implementation UISearchBarTest 18 | - (UITableView *)tableView { 19 | if (_tableView == nil) { 20 | _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain]; 21 | _tableView.delegate = self; 22 | _tableView.dataSource = self; 23 | [self.view addSubview:_tableView]; 24 | } 25 | 26 | return _tableView; 27 | } 28 | - (void)viewDidLoad { 29 | [super viewDidLoad]; 30 | // Do any additional setup after loading the view. 31 | 32 | 33 | // 创建UISearchController, 这里使用当前控制器来展示结果 34 | UISearchController *search = [[UISearchController alloc]initWithSearchResultsController:nil]; 35 | // 设置结果更新代理 36 | search.searchResultsUpdater = self; 37 | // 因为在当前控制器展示结果, 所以不需要这个透明视图 38 | search.dimsBackgroundDuringPresentation = NO; 39 | // 是否自动隐藏导航 40 | // search.hidesNavigationBarDuringPresentation = NO; 41 | self.searchController = search; 42 | 43 | search.searchBar.delegate = self; 44 | 45 | // search.searchBar.barStyle = UIBarStyleBlack; 46 | search.searchBar.prompt = @"这是一个prompt"; 47 | 48 | 49 | 50 | 51 | 52 | // search.searchBar.tintColor = [UIColor redColor]; 53 | // 修改取消按钮 颜色 54 | // [[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor redColor], NSFontAttributeName: [UIFont systemFontOfSize:16]} forState:UIControlStateNormal]; 55 | // 56 | // [[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setTitle:@"souSuo"]; 57 | 58 | 59 | search.searchBar.barTintColor = [UIColor greenColor]; 60 | search.searchBar.backgroundColor = [UIColor orangeColor]; 61 | 62 | 63 | search.searchBar.scopeButtonTitles = @[@"A", @"B"]; 64 | // search.searchBar.showsScopeBar = YES; 65 | 66 | self.tableView.tableHeaderView = search.searchBar; 67 | 68 | [search.searchBar sizeToFit]; 69 | 70 | 71 | 72 | UILabel *label = [[UILabel alloc]init]; 73 | label.text = @"这是一个inputAccessoryView"; 74 | label.textAlignment = NSTextAlignmentCenter; 75 | label.textColor = [UIColor blackColor]; 76 | 77 | label.frame = CGRectMake(0, 0, 0, 30); 78 | label.backgroundColor = [UIColor redColor]; 79 | search.searchBar.inputAccessoryView = label; 80 | 81 | // search.searchBar.backgroundImage = [UIImage imageNamed:@"40fe711f9b754b596159f3a6.jpg"]; 82 | // search.searchBar.scopeBarBackgroundImage = [UIImage imageNamed:@"9c16fdfaaf51f3de3b5b8e0d94eef01f3b2979e9.jpg"]; 83 | 84 | // [search.searchBar setBackgroundImage:[UIImage imageNamed:@"40fe711f9b754b596159f3a6.jpg"] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; 85 | // 86 | // [search.searchBar setSearchFieldBackgroundImage:[UIImage imageNamed:@"aaaaa.png"] forState:UIControlStateNormal]; 87 | 88 | [search.searchBar setImage:[UIImage imageNamed:@"MoreExpressionShops"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal]; 89 | 90 | 91 | // 修改偏移量 92 | // search.searchBar.searchTextPositionAdjustment = UIOffsetMake(20, 0); 93 | // search.searchBar.searchFieldBackgroundPositionAdjustment = UIOffsetMake(20, 0); 94 | 95 | // search.searchBar.showsCancelButton = YES; 96 | 97 | // UIView *backView = [search.searchBar.subviews firstObject]; 98 | // 99 | // 100 | // UITextField *textField = nil; 101 | // 102 | // for (UIView *tmp in backView.subviews) { 103 | // 104 | // if ([tmp isKindOfClass:NSClassFromString(@"UISearchBarTextField")]) { 105 | // 106 | // textField = (UITextField *)tmp; 107 | // break; 108 | // } 109 | // } 110 | // // 找到这个textField, 就可以按UITextField类来设置了 111 | // if (textField) { 112 | // 113 | // textField.tintColor = [UIColor orangeColor]; 114 | // } 115 | 116 | 117 | UIView *backView = [[search.searchBar.subviews firstObject].subviews firstObject]; 118 | 119 | UISegmentedControl *segmentedController = nil; 120 | // 找到 UISegmentedControl 121 | for (UIView *tmp in backView.subviews) { 122 | 123 | if ([tmp isKindOfClass:[UISegmentedControl class]]) { 124 | 125 | segmentedController = (UISegmentedControl *)tmp; 126 | break; 127 | } 128 | } 129 | // 如果存在 130 | if (segmentedController) { 131 | 132 | [segmentedController setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor redColor]} forState:UIControlStateNormal]; 133 | [segmentedController setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor blackColor]} forState:UIControlStateSelected]; 134 | // 设置中颜色 135 | segmentedController.tintColor = [UIColor redColor]; 136 | } 137 | 138 | } 139 | 140 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 141 | 142 | return 10; 143 | } 144 | 145 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 146 | 147 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"]; 148 | if (cell == nil) { 149 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cellID"]; 150 | } 151 | 152 | // 这里通过searchController的active属性来区分展示数据源是哪个 153 | cell.textLabel.text = [NSString stringWithFormat:@"%ld---%ld", (long)indexPath.section, (long)indexPath.row]; 154 | 155 | return cell; 156 | } 157 | 158 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 159 | 160 | 161 | } 162 | 163 | #pragma mark - UISearchResultsUpdating 164 | - (void)updateSearchResultsForSearchController:(UISearchController *)searchController { 165 | 166 | } 167 | 168 | #pragma mark - UISearchBarDelegate 169 | - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar{ 170 | 171 | NSLog(@"searchBarShouldBeginEditing >>%@", NSStringFromCGRect(searchBar.frame)); 172 | 173 | [searchBar setShowsCancelButton:YES animated:YES]; 174 | 175 | UIButton *cancelButton = nil; 176 | UIView *tempView = [searchBar.subviews firstObject]; 177 | for (UIView *sub in tempView.subviews) { 178 | 179 | if ([sub isKindOfClass:NSClassFromString(@"UINavigationButton")]) { 180 | 181 | cancelButton = (UIButton*)sub; 182 | } 183 | } 184 | 185 | if (cancelButton) { 186 | 187 | [cancelButton setTitle:@"取消" forState:UIControlStateNormal]; 188 | 189 | // [cancelButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; 190 | } 191 | 192 | UIButton *canceLBtn = [self.searchController.searchBar valueForKey:@"cancelButton"]; 193 | 194 | // searchBar.showsCancelButton = YES; 195 | 196 | for (UIView *sub in tempView.subviews) { 197 | 198 | if ([sub isKindOfClass:NSClassFromString(@"UINavigationButton")]) { 199 | 200 | cancelButton = (UIButton*)sub; 201 | } 202 | } 203 | 204 | // [searchBar setShowsScopeBar:YES]; 205 | 206 | 207 | 208 | return YES; 209 | } 210 | - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { 211 | 212 | NSLog(@"searchBarTextDidBeginEditing >>%@", NSStringFromCGRect(searchBar.frame)); 213 | 214 | // UIButton *canceLBtn = [searchBar valueForKey:@"cancelButton"]; 215 | // [canceLBtn setTitle:@"取消" forState:UIControlStateNormal]; 216 | // [canceLBtn setTitleColor:[UIColor colorWithRed:14.0/255.0 green:180.0/255.0 blue:0.0/255.0 alpha:1.00] forState:UIControlStateNormal]; 217 | 218 | // CGRect rect = searchBar.frame; 219 | // rect.size.height = 88; 220 | // searchBar.frame = rect; 221 | 222 | 223 | // [searchBar sizeToFit]; 224 | 225 | // [searchBar layoutIfNeeded]; 226 | 227 | // 修改UISearchBar右侧的取消按钮文字颜色及背景图片 228 | 229 | 230 | 231 | 232 | } 233 | - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar { 234 | 235 | NSLog(@"searchBarShouldEndEditing >>%@", NSStringFromCGRect(searchBar.frame)); 236 | return YES; 237 | } 238 | 239 | - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar { 240 | 241 | NSLog(@"searchBarTextDidEndEditing >>%@", NSStringFromCGRect(searchBar.frame)); 242 | 243 | // [searchBar sizeToFit]; 244 | } 245 | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { 246 | 247 | NSLog(@"textDidChange >>%@", NSStringFromCGRect(searchBar.frame)); 248 | } 249 | 250 | - (void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange:(NSInteger)selectedScope { 251 | 252 | NSLog(@"selectedScopeButtonIndexDidChange"); 253 | 254 | 255 | } 256 | - (void)didReceiveMemoryWarning { 257 | [super didReceiveMemoryWarning]; 258 | // Dispose of any resources that can be recreated. 259 | } 260 | 261 | /* 262 | #pragma mark - Navigation 263 | 264 | // In a storyboard-based application, you will often want to do a little preparation before navigation 265 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 266 | // Get the new view controller using [segue destinationViewController]. 267 | // Pass the selected object to the new view controller. 268 | } 269 | */ 270 | 271 | @end 272 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/UISearchBar/aaaaa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qrices/LSearchController/8bfa7051089f3d5d3cba1399713e156b55e2d16a/LZSearchController/LZSearchController/UISearchBar/aaaaa.png -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/17. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/17. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @property (nonatomic, strong) UITableView *tableView; 14 | @property (nonatomic, strong) NSMutableArray *datas; 15 | @property (nonatomic, strong) NSMutableArray *classes; 16 | @end 17 | 18 | @implementation ViewController 19 | - (NSMutableArray *)datas { 20 | if (_datas == nil) { 21 | _datas = [NSMutableArray arrayWithObjects:@"LZSearchController", @"LZViewController", @"LZCustomViewController", @"UISearchBarTest", nil]; 22 | } 23 | 24 | return _datas; 25 | } 26 | 27 | - (NSMutableArray *)classes { 28 | if (_classes == nil) { 29 | _classes = [NSMutableArray arrayWithObjects:@"LZSearchController", @"LZViewController", @"LZCustomViewController", @"UISearchBarTest", nil]; 30 | } 31 | 32 | return _classes; 33 | } 34 | 35 | - (UITableView *)tableView { 36 | if (_tableView == nil) { 37 | _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain]; 38 | _tableView.delegate = self; 39 | _tableView.dataSource = self; 40 | [self.view addSubview:_tableView]; 41 | } 42 | 43 | return _tableView; 44 | } 45 | 46 | - (void)viewDidLoad { 47 | [super viewDidLoad]; 48 | // Do any additional setup after loading the view, typically from a nib. 49 | self.view.backgroundColor = [UIColor whiteColor]; 50 | 51 | [self tableView]; 52 | } 53 | 54 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 55 | 56 | return self.datas.count; 57 | } 58 | 59 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 60 | 61 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"]; 62 | 63 | if (cell == nil) { 64 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cellID"]; 65 | } 66 | 67 | cell.textLabel.text = self.datas[indexPath.row]; 68 | return cell; 69 | } 70 | 71 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 72 | 73 | Class class = NSClassFromString([self.classes objectAtIndex:indexPath.row]); 74 | 75 | UIViewController *vc = [[class alloc]init]; 76 | 77 | [self.navigationController pushViewController:vc animated:YES]; 78 | } 79 | - (void)didReceiveMemoryWarning { 80 | [super didReceiveMemoryWarning]; 81 | // Dispose of any resources that can be recreated. 82 | } 83 | 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchController/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LZSearchController 4 | // 5 | // Created by Artron_LQQ on 2016/12/17. 6 | // Copyright © 2016年 Artup. 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 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchControllerUITests/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 | -------------------------------------------------------------------------------- /LZSearchController/LZSearchControllerUITests/LZSearchControllerUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LZSearchControllerUITests.m 3 | // LZSearchControllerUITests 4 | // 5 | // Created by Artron_LQQ on 2016/12/17. 6 | // Copyright © 2016年 Artup. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LZSearchControllerUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LZSearchControllerUITests 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 | # LZSearchController 2 | 搜索框简单使用 3 | 4 | ### 博文讲解[[iOS]系统UISearchController详解](http://www.jianshu.com/p/aa9a153a5b58) 5 | ### 欢迎star 6 | --------------------------------------------------------------------------------