├── DWCustomTabBarDemo ├── DWCustomTabBarDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── DWCustomTabBarDemo.xccheckout │ │ └── xcuserdata │ │ │ └── damon.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── damon.xcuserdatad │ │ └── xcschemes │ │ ├── DWCustomTabBarDemo.xcscheme │ │ └── xcschememanagement.plist └── DWCustomTabBarDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── NavBar │ │ ├── Contents.json │ │ ├── home_bar_scan.imageset │ │ │ ├── Contents.json │ │ │ ├── home_bar_scan@2x.png │ │ │ └── home_bar_scan@3x.png │ │ ├── home_title_slogan.imageset │ │ │ ├── Contents.json │ │ │ ├── home_title_slogan@2x.png │ │ │ └── home_title_slogan@3x.png │ │ └── icon_search.imageset │ │ │ ├── Contents.json │ │ │ ├── icon_search@2x.png │ │ │ └── icon_search@3x.png │ └── TabBarIcon │ │ ├── Contents.json │ │ ├── account_highlight.imageset │ │ ├── Contents.json │ │ └── account_highlight@2x.png │ │ ├── account_normal.imageset │ │ ├── Contents.json │ │ └── account_normal@2x.png │ │ ├── home_highlight.imageset │ │ ├── Contents.json │ │ └── home_highlight@2x.png │ │ ├── home_normal.imageset │ │ ├── Contents.json │ │ └── home_normal@2x.png │ │ ├── message_highlight.imageset │ │ ├── Contents.json │ │ └── message_highlight@2x.png │ │ ├── message_normal.imageset │ │ ├── Contents.json │ │ └── message_normal@2x.png │ │ ├── mycity_highlight.imageset │ │ ├── Contents.json │ │ └── mycity_highlight@2x.png │ │ ├── mycity_normal.imageset │ │ ├── Contents.json │ │ └── mycity_normal@2x.png │ │ ├── post_normal.imageset │ │ ├── Contents.json │ │ └── post_normal@2x.png │ │ └── tapbar_top_line.imageset │ │ ├── Contents.json │ │ └── tapbar_top_line@2x.png │ ├── Classes │ ├── Home │ │ ├── DWHomeViewController.h │ │ └── DWHomeViewController.m │ ├── Main │ │ ├── Controller │ │ │ ├── DWTabBarController.h │ │ │ └── DWTabBarController.m │ │ └── View │ │ │ ├── DWPublishButton.h │ │ │ ├── DWPublishButton.m │ │ │ ├── DWTabBar.h │ │ │ └── DWTabBar.m │ ├── Message │ │ ├── DWMessageViewController.h │ │ └── DWMessageViewController.m │ ├── Mine │ │ ├── DWMineViewController.h │ │ └── DWMineViewController.m │ └── SameCity │ │ ├── DWSameFityViewController.h │ │ └── DWSameFityViewController.m │ ├── Info.plist │ └── main.m └── README.md /DWCustomTabBarDemo/DWCustomTabBarDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E456563F1BD5CC40004A519D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E456563E1BD5CC40004A519D /* main.m */; }; 11 | E45656421BD5CC40004A519D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E45656411BD5CC40004A519D /* AppDelegate.m */; }; 12 | E456564A1BD5CC40004A519D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E45656491BD5CC40004A519D /* Assets.xcassets */; }; 13 | E456567A1BD5D039004A519D /* DWHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E45656791BD5D039004A519D /* DWHomeViewController.m */; settings = {ASSET_TAGS = (); }; }; 14 | E456567D1BD5D05F004A519D /* DWMessageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E456567C1BD5D05F004A519D /* DWMessageViewController.m */; settings = {ASSET_TAGS = (); }; }; 15 | E45656801BD5D076004A519D /* DWMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E456567F1BD5D076004A519D /* DWMineViewController.m */; settings = {ASSET_TAGS = (); }; }; 16 | E45656831BD5D08F004A519D /* DWSameFityViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E45656821BD5D08F004A519D /* DWSameFityViewController.m */; settings = {ASSET_TAGS = (); }; }; 17 | E456568C1BD5D104004A519D /* DWTabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = E456568A1BD5D104004A519D /* DWTabBarController.m */; settings = {ASSET_TAGS = (); }; }; 18 | E456568F1BD5D6AC004A519D /* DWTabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = E456568E1BD5D6AC004A519D /* DWTabBar.m */; settings = {ASSET_TAGS = (); }; }; 19 | E45656981BD5E373004A519D /* DWPublishButton.m in Sources */ = {isa = PBXBuildFile; fileRef = E45656971BD5E373004A519D /* DWPublishButton.m */; settings = {ASSET_TAGS = (); }; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | E45656541BD5CC40004A519D /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = E45656321BD5CC40004A519D /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = E45656391BD5CC40004A519D; 28 | remoteInfo = DWCustomTabBarDemo; 29 | }; 30 | E456565F1BD5CC40004A519D /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = E45656321BD5CC40004A519D /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = E45656391BD5CC40004A519D; 35 | remoteInfo = DWCustomTabBarDemo; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | E456563A1BD5CC40004A519D /* DWCustomTabBarDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DWCustomTabBarDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | E456563E1BD5CC40004A519D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | E45656401BD5CC40004A519D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 43 | E45656411BD5CC40004A519D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 44 | E45656491BD5CC40004A519D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | E456564E1BD5CC40004A519D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | E45656531BD5CC40004A519D /* DWCustomTabBarDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DWCustomTabBarDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | E456565E1BD5CC40004A519D /* DWCustomTabBarDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DWCustomTabBarDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | E45656781BD5D039004A519D /* DWHomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWHomeViewController.h; sourceTree = ""; }; 49 | E45656791BD5D039004A519D /* DWHomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWHomeViewController.m; sourceTree = ""; }; 50 | E456567B1BD5D05F004A519D /* DWMessageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWMessageViewController.h; sourceTree = ""; }; 51 | E456567C1BD5D05F004A519D /* DWMessageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWMessageViewController.m; sourceTree = ""; }; 52 | E456567E1BD5D076004A519D /* DWMineViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWMineViewController.h; sourceTree = ""; }; 53 | E456567F1BD5D076004A519D /* DWMineViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWMineViewController.m; sourceTree = ""; }; 54 | E45656811BD5D08F004A519D /* DWSameFityViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWSameFityViewController.h; sourceTree = ""; }; 55 | E45656821BD5D08F004A519D /* DWSameFityViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWSameFityViewController.m; sourceTree = ""; }; 56 | E45656891BD5D104004A519D /* DWTabBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWTabBarController.h; sourceTree = ""; }; 57 | E456568A1BD5D104004A519D /* DWTabBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWTabBarController.m; sourceTree = ""; }; 58 | E456568D1BD5D6AC004A519D /* DWTabBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWTabBar.h; sourceTree = ""; }; 59 | E456568E1BD5D6AC004A519D /* DWTabBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWTabBar.m; sourceTree = ""; }; 60 | E45656961BD5E373004A519D /* DWPublishButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWPublishButton.h; sourceTree = ""; }; 61 | E45656971BD5E373004A519D /* DWPublishButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWPublishButton.m; sourceTree = ""; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | E45656371BD5CC40004A519D /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | E45656501BD5CC40004A519D /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | E456565B1BD5CC40004A519D /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | /* End PBXFrameworksBuildPhase section */ 87 | 88 | /* Begin PBXGroup section */ 89 | E45656311BD5CC40004A519D = { 90 | isa = PBXGroup; 91 | children = ( 92 | E456563C1BD5CC40004A519D /* DWCustomTabBarDemo */, 93 | E456563B1BD5CC40004A519D /* Products */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | E456563B1BD5CC40004A519D /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | E456563A1BD5CC40004A519D /* DWCustomTabBarDemo.app */, 101 | E45656531BD5CC40004A519D /* DWCustomTabBarDemoTests.xctest */, 102 | E456565E1BD5CC40004A519D /* DWCustomTabBarDemoUITests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | E456563C1BD5CC40004A519D /* DWCustomTabBarDemo */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | E45656701BD5CE58004A519D /* Classes */, 111 | E45656401BD5CC40004A519D /* AppDelegate.h */, 112 | E45656411BD5CC40004A519D /* AppDelegate.m */, 113 | E45656491BD5CC40004A519D /* Assets.xcassets */, 114 | E456564E1BD5CC40004A519D /* Info.plist */, 115 | E456563D1BD5CC40004A519D /* Supporting Files */, 116 | ); 117 | path = DWCustomTabBarDemo; 118 | sourceTree = ""; 119 | }; 120 | E456563D1BD5CC40004A519D /* Supporting Files */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | E456563E1BD5CC40004A519D /* main.m */, 124 | ); 125 | name = "Supporting Files"; 126 | sourceTree = ""; 127 | }; 128 | E45656701BD5CE58004A519D /* Classes */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | E45656841BD5D0BB004A519D /* Main */, 132 | E45656711BD5CE58004A519D /* Home */, 133 | E45656721BD5CE58004A519D /* Message */, 134 | E45656731BD5CE58004A519D /* Mine */, 135 | E45656741BD5CE58004A519D /* SameCity */, 136 | ); 137 | path = Classes; 138 | sourceTree = ""; 139 | }; 140 | E45656711BD5CE58004A519D /* Home */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | E45656781BD5D039004A519D /* DWHomeViewController.h */, 144 | E45656791BD5D039004A519D /* DWHomeViewController.m */, 145 | ); 146 | path = Home; 147 | sourceTree = ""; 148 | }; 149 | E45656721BD5CE58004A519D /* Message */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | E456567B1BD5D05F004A519D /* DWMessageViewController.h */, 153 | E456567C1BD5D05F004A519D /* DWMessageViewController.m */, 154 | ); 155 | path = Message; 156 | sourceTree = ""; 157 | }; 158 | E45656731BD5CE58004A519D /* Mine */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | E456567E1BD5D076004A519D /* DWMineViewController.h */, 162 | E456567F1BD5D076004A519D /* DWMineViewController.m */, 163 | ); 164 | path = Mine; 165 | sourceTree = ""; 166 | }; 167 | E45656741BD5CE58004A519D /* SameCity */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | E45656811BD5D08F004A519D /* DWSameFityViewController.h */, 171 | E45656821BD5D08F004A519D /* DWSameFityViewController.m */, 172 | ); 173 | path = SameCity; 174 | sourceTree = ""; 175 | }; 176 | E45656841BD5D0BB004A519D /* Main */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | E45656881BD5D104004A519D /* Controller */, 180 | E456568B1BD5D104004A519D /* View */, 181 | ); 182 | path = Main; 183 | sourceTree = ""; 184 | }; 185 | E45656881BD5D104004A519D /* Controller */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | E45656891BD5D104004A519D /* DWTabBarController.h */, 189 | E456568A1BD5D104004A519D /* DWTabBarController.m */, 190 | ); 191 | path = Controller; 192 | sourceTree = ""; 193 | }; 194 | E456568B1BD5D104004A519D /* View */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | E456568D1BD5D6AC004A519D /* DWTabBar.h */, 198 | E456568E1BD5D6AC004A519D /* DWTabBar.m */, 199 | E45656961BD5E373004A519D /* DWPublishButton.h */, 200 | E45656971BD5E373004A519D /* DWPublishButton.m */, 201 | ); 202 | path = View; 203 | sourceTree = ""; 204 | }; 205 | /* End PBXGroup section */ 206 | 207 | /* Begin PBXNativeTarget section */ 208 | E45656391BD5CC40004A519D /* DWCustomTabBarDemo */ = { 209 | isa = PBXNativeTarget; 210 | buildConfigurationList = E45656671BD5CC41004A519D /* Build configuration list for PBXNativeTarget "DWCustomTabBarDemo" */; 211 | buildPhases = ( 212 | E45656361BD5CC40004A519D /* Sources */, 213 | E45656371BD5CC40004A519D /* Frameworks */, 214 | E45656381BD5CC40004A519D /* Resources */, 215 | ); 216 | buildRules = ( 217 | ); 218 | dependencies = ( 219 | ); 220 | name = DWCustomTabBarDemo; 221 | productName = DWCustomTabBarDemo; 222 | productReference = E456563A1BD5CC40004A519D /* DWCustomTabBarDemo.app */; 223 | productType = "com.apple.product-type.application"; 224 | }; 225 | E45656521BD5CC40004A519D /* DWCustomTabBarDemoTests */ = { 226 | isa = PBXNativeTarget; 227 | buildConfigurationList = E456566A1BD5CC41004A519D /* Build configuration list for PBXNativeTarget "DWCustomTabBarDemoTests" */; 228 | buildPhases = ( 229 | E456564F1BD5CC40004A519D /* Sources */, 230 | E45656501BD5CC40004A519D /* Frameworks */, 231 | E45656511BD5CC40004A519D /* Resources */, 232 | ); 233 | buildRules = ( 234 | ); 235 | dependencies = ( 236 | E45656551BD5CC40004A519D /* PBXTargetDependency */, 237 | ); 238 | name = DWCustomTabBarDemoTests; 239 | productName = DWCustomTabBarDemoTests; 240 | productReference = E45656531BD5CC40004A519D /* DWCustomTabBarDemoTests.xctest */; 241 | productType = "com.apple.product-type.bundle.unit-test"; 242 | }; 243 | E456565D1BD5CC40004A519D /* DWCustomTabBarDemoUITests */ = { 244 | isa = PBXNativeTarget; 245 | buildConfigurationList = E456566D1BD5CC41004A519D /* Build configuration list for PBXNativeTarget "DWCustomTabBarDemoUITests" */; 246 | buildPhases = ( 247 | E456565A1BD5CC40004A519D /* Sources */, 248 | E456565B1BD5CC40004A519D /* Frameworks */, 249 | E456565C1BD5CC40004A519D /* Resources */, 250 | ); 251 | buildRules = ( 252 | ); 253 | dependencies = ( 254 | E45656601BD5CC40004A519D /* PBXTargetDependency */, 255 | ); 256 | name = DWCustomTabBarDemoUITests; 257 | productName = DWCustomTabBarDemoUITests; 258 | productReference = E456565E1BD5CC40004A519D /* DWCustomTabBarDemoUITests.xctest */; 259 | productType = "com.apple.product-type.bundle.ui-testing"; 260 | }; 261 | /* End PBXNativeTarget section */ 262 | 263 | /* Begin PBXProject section */ 264 | E45656321BD5CC40004A519D /* Project object */ = { 265 | isa = PBXProject; 266 | attributes = { 267 | LastUpgradeCheck = 0700; 268 | ORGANIZATIONNAME = damonwong; 269 | TargetAttributes = { 270 | E45656391BD5CC40004A519D = { 271 | CreatedOnToolsVersion = 7.0; 272 | DevelopmentTeam = L87YACW6V9; 273 | }; 274 | E45656521BD5CC40004A519D = { 275 | CreatedOnToolsVersion = 7.0; 276 | DevelopmentTeam = L87YACW6V9; 277 | TestTargetID = E45656391BD5CC40004A519D; 278 | }; 279 | E456565D1BD5CC40004A519D = { 280 | CreatedOnToolsVersion = 7.0; 281 | DevelopmentTeam = L87YACW6V9; 282 | TestTargetID = E45656391BD5CC40004A519D; 283 | }; 284 | }; 285 | }; 286 | buildConfigurationList = E45656351BD5CC40004A519D /* Build configuration list for PBXProject "DWCustomTabBarDemo" */; 287 | compatibilityVersion = "Xcode 3.2"; 288 | developmentRegion = English; 289 | hasScannedForEncodings = 0; 290 | knownRegions = ( 291 | en, 292 | Base, 293 | ); 294 | mainGroup = E45656311BD5CC40004A519D; 295 | productRefGroup = E456563B1BD5CC40004A519D /* Products */; 296 | projectDirPath = ""; 297 | projectRoot = ""; 298 | targets = ( 299 | E45656391BD5CC40004A519D /* DWCustomTabBarDemo */, 300 | E45656521BD5CC40004A519D /* DWCustomTabBarDemoTests */, 301 | E456565D1BD5CC40004A519D /* DWCustomTabBarDemoUITests */, 302 | ); 303 | }; 304 | /* End PBXProject section */ 305 | 306 | /* Begin PBXResourcesBuildPhase section */ 307 | E45656381BD5CC40004A519D /* Resources */ = { 308 | isa = PBXResourcesBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | E456564A1BD5CC40004A519D /* Assets.xcassets in Resources */, 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | E45656511BD5CC40004A519D /* Resources */ = { 316 | isa = PBXResourcesBuildPhase; 317 | buildActionMask = 2147483647; 318 | files = ( 319 | ); 320 | runOnlyForDeploymentPostprocessing = 0; 321 | }; 322 | E456565C1BD5CC40004A519D /* Resources */ = { 323 | isa = PBXResourcesBuildPhase; 324 | buildActionMask = 2147483647; 325 | files = ( 326 | ); 327 | runOnlyForDeploymentPostprocessing = 0; 328 | }; 329 | /* End PBXResourcesBuildPhase section */ 330 | 331 | /* Begin PBXSourcesBuildPhase section */ 332 | E45656361BD5CC40004A519D /* Sources */ = { 333 | isa = PBXSourcesBuildPhase; 334 | buildActionMask = 2147483647; 335 | files = ( 336 | E456567A1BD5D039004A519D /* DWHomeViewController.m in Sources */, 337 | E45656421BD5CC40004A519D /* AppDelegate.m in Sources */, 338 | E45656831BD5D08F004A519D /* DWSameFityViewController.m in Sources */, 339 | E456568C1BD5D104004A519D /* DWTabBarController.m in Sources */, 340 | E45656981BD5E373004A519D /* DWPublishButton.m in Sources */, 341 | E456568F1BD5D6AC004A519D /* DWTabBar.m in Sources */, 342 | E45656801BD5D076004A519D /* DWMineViewController.m in Sources */, 343 | E456563F1BD5CC40004A519D /* main.m in Sources */, 344 | E456567D1BD5D05F004A519D /* DWMessageViewController.m in Sources */, 345 | ); 346 | runOnlyForDeploymentPostprocessing = 0; 347 | }; 348 | E456564F1BD5CC40004A519D /* Sources */ = { 349 | isa = PBXSourcesBuildPhase; 350 | buildActionMask = 2147483647; 351 | files = ( 352 | ); 353 | runOnlyForDeploymentPostprocessing = 0; 354 | }; 355 | E456565A1BD5CC40004A519D /* Sources */ = { 356 | isa = PBXSourcesBuildPhase; 357 | buildActionMask = 2147483647; 358 | files = ( 359 | ); 360 | runOnlyForDeploymentPostprocessing = 0; 361 | }; 362 | /* End PBXSourcesBuildPhase section */ 363 | 364 | /* Begin PBXTargetDependency section */ 365 | E45656551BD5CC40004A519D /* PBXTargetDependency */ = { 366 | isa = PBXTargetDependency; 367 | target = E45656391BD5CC40004A519D /* DWCustomTabBarDemo */; 368 | targetProxy = E45656541BD5CC40004A519D /* PBXContainerItemProxy */; 369 | }; 370 | E45656601BD5CC40004A519D /* PBXTargetDependency */ = { 371 | isa = PBXTargetDependency; 372 | target = E45656391BD5CC40004A519D /* DWCustomTabBarDemo */; 373 | targetProxy = E456565F1BD5CC40004A519D /* PBXContainerItemProxy */; 374 | }; 375 | /* End PBXTargetDependency section */ 376 | 377 | /* Begin XCBuildConfiguration section */ 378 | E45656651BD5CC41004A519D /* Debug */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ALWAYS_SEARCH_USER_PATHS = NO; 382 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 383 | CLANG_CXX_LIBRARY = "libc++"; 384 | CLANG_ENABLE_MODULES = YES; 385 | CLANG_ENABLE_OBJC_ARC = YES; 386 | CLANG_WARN_BOOL_CONVERSION = YES; 387 | CLANG_WARN_CONSTANT_CONVERSION = YES; 388 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 389 | CLANG_WARN_EMPTY_BODY = YES; 390 | CLANG_WARN_ENUM_CONVERSION = YES; 391 | CLANG_WARN_INT_CONVERSION = YES; 392 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 393 | CLANG_WARN_UNREACHABLE_CODE = YES; 394 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 395 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 396 | COPY_PHASE_STRIP = NO; 397 | DEBUG_INFORMATION_FORMAT = dwarf; 398 | ENABLE_STRICT_OBJC_MSGSEND = YES; 399 | ENABLE_TESTABILITY = YES; 400 | GCC_C_LANGUAGE_STANDARD = gnu99; 401 | GCC_DYNAMIC_NO_PIC = NO; 402 | GCC_NO_COMMON_BLOCKS = YES; 403 | GCC_OPTIMIZATION_LEVEL = 0; 404 | GCC_PREPROCESSOR_DEFINITIONS = ( 405 | "DEBUG=1", 406 | "$(inherited)", 407 | ); 408 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 410 | GCC_WARN_UNDECLARED_SELECTOR = YES; 411 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 412 | GCC_WARN_UNUSED_FUNCTION = YES; 413 | GCC_WARN_UNUSED_VARIABLE = YES; 414 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 415 | MTL_ENABLE_DEBUG_INFO = YES; 416 | ONLY_ACTIVE_ARCH = YES; 417 | SDKROOT = iphoneos; 418 | }; 419 | name = Debug; 420 | }; 421 | E45656661BD5CC41004A519D /* Release */ = { 422 | isa = XCBuildConfiguration; 423 | buildSettings = { 424 | ALWAYS_SEARCH_USER_PATHS = NO; 425 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 426 | CLANG_CXX_LIBRARY = "libc++"; 427 | CLANG_ENABLE_MODULES = YES; 428 | CLANG_ENABLE_OBJC_ARC = YES; 429 | CLANG_WARN_BOOL_CONVERSION = YES; 430 | CLANG_WARN_CONSTANT_CONVERSION = YES; 431 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 432 | CLANG_WARN_EMPTY_BODY = YES; 433 | CLANG_WARN_ENUM_CONVERSION = YES; 434 | CLANG_WARN_INT_CONVERSION = YES; 435 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 436 | CLANG_WARN_UNREACHABLE_CODE = YES; 437 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 438 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 439 | COPY_PHASE_STRIP = NO; 440 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 441 | ENABLE_NS_ASSERTIONS = NO; 442 | ENABLE_STRICT_OBJC_MSGSEND = YES; 443 | GCC_C_LANGUAGE_STANDARD = gnu99; 444 | GCC_NO_COMMON_BLOCKS = YES; 445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 446 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 447 | GCC_WARN_UNDECLARED_SELECTOR = YES; 448 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 449 | GCC_WARN_UNUSED_FUNCTION = YES; 450 | GCC_WARN_UNUSED_VARIABLE = YES; 451 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 452 | MTL_ENABLE_DEBUG_INFO = NO; 453 | SDKROOT = iphoneos; 454 | VALIDATE_PRODUCT = YES; 455 | }; 456 | name = Release; 457 | }; 458 | E45656681BD5CC41004A519D /* Debug */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 462 | CODE_SIGN_IDENTITY = "iPhone Developer"; 463 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 464 | INFOPLIST_FILE = DWCustomTabBarDemo/Info.plist; 465 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 466 | PRODUCT_BUNDLE_IDENTIFIER = com.damonwong.DWCustomTabBarDemo; 467 | PRODUCT_NAME = "$(TARGET_NAME)"; 468 | PROVISIONING_PROFILE = ""; 469 | }; 470 | name = Debug; 471 | }; 472 | E45656691BD5CC41004A519D /* Release */ = { 473 | isa = XCBuildConfiguration; 474 | buildSettings = { 475 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 476 | CODE_SIGN_IDENTITY = "iPhone Developer"; 477 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 478 | INFOPLIST_FILE = DWCustomTabBarDemo/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | PRODUCT_BUNDLE_IDENTIFIER = com.damonwong.DWCustomTabBarDemo; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | PROVISIONING_PROFILE = ""; 483 | }; 484 | name = Release; 485 | }; 486 | E456566B1BD5CC41004A519D /* Debug */ = { 487 | isa = XCBuildConfiguration; 488 | buildSettings = { 489 | BUNDLE_LOADER = "$(TEST_HOST)"; 490 | INFOPLIST_FILE = DWCustomTabBarDemoTests/Info.plist; 491 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 492 | PRODUCT_BUNDLE_IDENTIFIER = com.damonwong.DWCustomTabBarDemoTests; 493 | PRODUCT_NAME = "$(TARGET_NAME)"; 494 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DWCustomTabBarDemo.app/DWCustomTabBarDemo"; 495 | }; 496 | name = Debug; 497 | }; 498 | E456566C1BD5CC41004A519D /* Release */ = { 499 | isa = XCBuildConfiguration; 500 | buildSettings = { 501 | BUNDLE_LOADER = "$(TEST_HOST)"; 502 | INFOPLIST_FILE = DWCustomTabBarDemoTests/Info.plist; 503 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 504 | PRODUCT_BUNDLE_IDENTIFIER = com.damonwong.DWCustomTabBarDemoTests; 505 | PRODUCT_NAME = "$(TARGET_NAME)"; 506 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DWCustomTabBarDemo.app/DWCustomTabBarDemo"; 507 | }; 508 | name = Release; 509 | }; 510 | E456566E1BD5CC41004A519D /* Debug */ = { 511 | isa = XCBuildConfiguration; 512 | buildSettings = { 513 | INFOPLIST_FILE = DWCustomTabBarDemoUITests/Info.plist; 514 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 515 | PRODUCT_BUNDLE_IDENTIFIER = com.damonwong.DWCustomTabBarDemoUITests; 516 | PRODUCT_NAME = "$(TARGET_NAME)"; 517 | TEST_TARGET_NAME = DWCustomTabBarDemo; 518 | USES_XCTRUNNER = YES; 519 | }; 520 | name = Debug; 521 | }; 522 | E456566F1BD5CC41004A519D /* Release */ = { 523 | isa = XCBuildConfiguration; 524 | buildSettings = { 525 | INFOPLIST_FILE = DWCustomTabBarDemoUITests/Info.plist; 526 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 527 | PRODUCT_BUNDLE_IDENTIFIER = com.damonwong.DWCustomTabBarDemoUITests; 528 | PRODUCT_NAME = "$(TARGET_NAME)"; 529 | TEST_TARGET_NAME = DWCustomTabBarDemo; 530 | USES_XCTRUNNER = YES; 531 | }; 532 | name = Release; 533 | }; 534 | /* End XCBuildConfiguration section */ 535 | 536 | /* Begin XCConfigurationList section */ 537 | E45656351BD5CC40004A519D /* Build configuration list for PBXProject "DWCustomTabBarDemo" */ = { 538 | isa = XCConfigurationList; 539 | buildConfigurations = ( 540 | E45656651BD5CC41004A519D /* Debug */, 541 | E45656661BD5CC41004A519D /* Release */, 542 | ); 543 | defaultConfigurationIsVisible = 0; 544 | defaultConfigurationName = Release; 545 | }; 546 | E45656671BD5CC41004A519D /* Build configuration list for PBXNativeTarget "DWCustomTabBarDemo" */ = { 547 | isa = XCConfigurationList; 548 | buildConfigurations = ( 549 | E45656681BD5CC41004A519D /* Debug */, 550 | E45656691BD5CC41004A519D /* Release */, 551 | ); 552 | defaultConfigurationIsVisible = 0; 553 | defaultConfigurationName = Release; 554 | }; 555 | E456566A1BD5CC41004A519D /* Build configuration list for PBXNativeTarget "DWCustomTabBarDemoTests" */ = { 556 | isa = XCConfigurationList; 557 | buildConfigurations = ( 558 | E456566B1BD5CC41004A519D /* Debug */, 559 | E456566C1BD5CC41004A519D /* Release */, 560 | ); 561 | defaultConfigurationIsVisible = 0; 562 | defaultConfigurationName = Release; 563 | }; 564 | E456566D1BD5CC41004A519D /* Build configuration list for PBXNativeTarget "DWCustomTabBarDemoUITests" */ = { 565 | isa = XCConfigurationList; 566 | buildConfigurations = ( 567 | E456566E1BD5CC41004A519D /* Debug */, 568 | E456566F1BD5CC41004A519D /* Release */, 569 | ); 570 | defaultConfigurationIsVisible = 0; 571 | defaultConfigurationName = Release; 572 | }; 573 | /* End XCConfigurationList section */ 574 | }; 575 | rootObject = E45656321BD5CC40004A519D /* Project object */; 576 | } 577 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo.xcodeproj/project.xcworkspace/xcshareddata/DWCustomTabBarDemo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 3DA9B96E-8A32-40E3-B2F2-65F854D25B04 9 | IDESourceControlProjectName 10 | DWCustomTabBarDemo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 0B3413720BE2E04EDC9DE74F5FBAACBD00BF2FE7 14 | https://github.com/Damonvvong/DWCustomTabBarDemo.git 15 | 16 | IDESourceControlProjectPath 17 | DWCustomTabBarDemo/DWCustomTabBarDemo.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 0B3413720BE2E04EDC9DE74F5FBAACBD00BF2FE7 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/Damonvvong/DWCustomTabBarDemo.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 0B3413720BE2E04EDC9DE74F5FBAACBD00BF2FE7 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 0B3413720BE2E04EDC9DE74F5FBAACBD00BF2FE7 36 | IDESourceControlWCCName 37 | DWCustomTabBarDemo 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo.xcodeproj/project.xcworkspace/xcuserdata/damon.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo.xcodeproj/project.xcworkspace/xcuserdata/damon.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo.xcodeproj/xcuserdata/damon.xcuserdatad/xcschemes/DWCustomTabBarDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo.xcodeproj/xcuserdata/damon.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DWCustomTabBarDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | E45656391BD5CC40004A519D 16 | 17 | primary 18 | 19 | 20 | E45656521BD5CC40004A519D 21 | 22 | primary 23 | 24 | 25 | E456565D1BD5CC40004A519D 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. 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 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "DWTabBarController.h" 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | 22 | // 设置主窗口,并设置跟控制器 23 | 24 | self.window = [[UIWindow alloc]init]; 25 | 26 | self.window.frame = [UIScreen mainScreen].bounds; 27 | 28 | self.window.rootViewController = [[DWTabBarController alloc]init]; 29 | 30 | [self.window makeKeyAndVisible]; 31 | 32 | return YES; 33 | } 34 | 35 | - (void)applicationWillResignActive:(UIApplication *)application { 36 | // 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. 37 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 38 | } 39 | 40 | - (void)applicationDidEnterBackground:(UIApplication *)application { 41 | // 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. 42 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 43 | } 44 | 45 | - (void)applicationWillEnterForeground:(UIApplication *)application { 46 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 47 | } 48 | 49 | - (void)applicationDidBecomeActive:(UIApplication *)application { 50 | // 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. 51 | } 52 | 53 | - (void)applicationWillTerminate:(UIApplication *)application { 54 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/home_bar_scan.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "home_bar_scan@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x", 15 | "filename" : "home_bar_scan@3x.png" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/home_bar_scan.imageset/home_bar_scan@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/home_bar_scan.imageset/home_bar_scan@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/home_bar_scan.imageset/home_bar_scan@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/home_bar_scan.imageset/home_bar_scan@3x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/home_title_slogan.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "home_title_slogan@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x", 15 | "filename" : "home_title_slogan@3x.png" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/home_title_slogan.imageset/home_title_slogan@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/home_title_slogan.imageset/home_title_slogan@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/home_title_slogan.imageset/home_title_slogan@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/home_title_slogan.imageset/home_title_slogan@3x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/icon_search.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_search@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x", 15 | "filename" : "icon_search@3x.png" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/icon_search.imageset/icon_search@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/icon_search.imageset/icon_search@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/icon_search.imageset/icon_search@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/NavBar/icon_search.imageset/icon_search@3x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/account_highlight.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "account_highlight@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/account_highlight.imageset/account_highlight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/account_highlight.imageset/account_highlight@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/account_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "account_normal@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/account_normal.imageset/account_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/account_normal.imageset/account_normal@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/home_highlight.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "home_highlight@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/home_highlight.imageset/home_highlight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/home_highlight.imageset/home_highlight@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/home_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "home_normal@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/home_normal.imageset/home_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/home_normal.imageset/home_normal@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/message_highlight.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "message_highlight@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/message_highlight.imageset/message_highlight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/message_highlight.imageset/message_highlight@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/message_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "message_normal@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/message_normal.imageset/message_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/message_normal.imageset/message_normal@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/mycity_highlight.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "mycity_highlight@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/mycity_highlight.imageset/mycity_highlight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/mycity_highlight.imageset/mycity_highlight@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/mycity_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "mycity_normal@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/mycity_normal.imageset/mycity_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/mycity_normal.imageset/mycity_normal@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/post_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "post_normal@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/post_normal.imageset/post_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/post_normal.imageset/post_normal@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/tapbar_top_line.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "tapbar_top_line@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/tapbar_top_line.imageset/tapbar_top_line@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Damonvvong/DWCustomTabBarDemo/ab0bf6994683063ba96855abae6bd3ee054d67e3/DWCustomTabBarDemo/DWCustomTabBarDemo/Assets.xcassets/TabBarIcon/tapbar_top_line.imageset/tapbar_top_line@2x.png -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Home/DWHomeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DWHomeViewController.h 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DWHomeViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Home/DWHomeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWHomeViewController.m 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import "DWHomeViewController.h" 10 | 11 | @implementation DWHomeViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Main/Controller/DWTabBarController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DWTabBarController.h 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DWTabBarController : UITabBarController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Main/Controller/DWTabBarController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWTabBarController.m 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import "DWTabBarController.h" 10 | 11 | #import "DWHomeViewController.h" 12 | #import "DWMessageViewController.h" 13 | #import "DWMineViewController.h" 14 | #import "DWSameFityViewController.h" 15 | 16 | #import "DWTabBar.h" 17 | 18 | #define DWColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] //<<< 用10进制表示颜色,例如(255,255,255)黑色 19 | #define DWRandomColor DWColor(arc4random_uniform(255), arc4random_uniform(255), arc4random_uniform(255)) 20 | 21 | @implementation DWTabBarController 22 | 23 | #pragma mark - 24 | #pragma mark - Life Cycle 25 | 26 | -(void)viewDidLoad{ 27 | 28 | [super viewDidLoad]; 29 | 30 | // 设置 TabBarItemTestAttributes 的颜色。 31 | [self setUpTabBarItemTextAttributes]; 32 | 33 | // 设置子控制器 34 | [self setUpChildViewController]; 35 | 36 | // 处理tabBar,使用自定义 tabBar 添加 发布按钮 37 | [self setUpTabBar]; 38 | 39 | [[UITabBar appearance] setBackgroundImage:[self imageWithColor:[UIColor whiteColor]]]; 40 | 41 | //去除 TabBar 自带的顶部阴影 42 | [[UITabBar appearance] setShadowImage:[[UIImage alloc] init]]; 43 | 44 | //设置导航控制器颜色为黄色 45 | [[UINavigationBar appearance] setBackgroundImage:[self imageWithColor:DWColor(253, 218, 68)] forBarMetrics:UIBarMetricsDefault]; 46 | 47 | 48 | 49 | } 50 | 51 | #pragma mark - 52 | #pragma mark - Private Methods 53 | 54 | /** 55 | * 利用 KVC 把 系统的 tabBar 类型改为自定义类型。 56 | */ 57 | - (void)setUpTabBar{ 58 | 59 | [self setValue:[[DWTabBar alloc] init] forKey:@"tabBar"]; 60 | } 61 | 62 | 63 | /** 64 | * tabBarItem 的选中和不选中文字属性 65 | */ 66 | - (void)setUpTabBarItemTextAttributes{ 67 | 68 | // 普通状态下的文字属性 69 | NSMutableDictionary *normalAttrs = [NSMutableDictionary dictionary]; 70 | normalAttrs[NSForegroundColorAttributeName] = [UIColor grayColor]; 71 | 72 | // 选中状态下的文字属性 73 | NSMutableDictionary *selectedAttrs = [NSMutableDictionary dictionary]; 74 | selectedAttrs[NSForegroundColorAttributeName] = [UIColor darkGrayColor]; 75 | 76 | // 设置文字属性 77 | UITabBarItem *tabBar = [UITabBarItem appearance]; 78 | [tabBar setTitleTextAttributes:normalAttrs forState:UIControlStateNormal]; 79 | [tabBar setTitleTextAttributes:normalAttrs forState:UIControlStateHighlighted]; 80 | 81 | } 82 | 83 | 84 | /** 85 | * 添加子控制器,我这里值添加了4个,没有占位自控制器 86 | */ 87 | - (void)setUpChildViewController{ 88 | 89 | [self addOneChildViewController:[[UINavigationController alloc]initWithRootViewController:[[DWHomeViewController alloc]init]] 90 | WithTitle:@"首页" 91 | imageName:@"home_normal" 92 | selectedImageName:@"home_highlight"]; 93 | 94 | [self addOneChildViewController:[[UINavigationController alloc]initWithRootViewController:[[DWSameFityViewController alloc] init]] 95 | WithTitle:@"同城" 96 | imageName:@"mycity_normal" 97 | selectedImageName:@"mycity_highlight"]; 98 | 99 | 100 | [self addOneChildViewController:[[UINavigationController alloc]initWithRootViewController:[[DWMessageViewController alloc]init]] 101 | WithTitle:@"消息" 102 | imageName:@"message_normal" 103 | selectedImageName:@"message_highlight"]; 104 | 105 | 106 | [self addOneChildViewController:[[UINavigationController alloc]initWithRootViewController:[[DWMineViewController alloc]init]] 107 | WithTitle:@"我的" 108 | imageName:@"account_normal" 109 | selectedImageName:@"account_highlight"]; 110 | 111 | } 112 | 113 | /** 114 | * 添加一个子控制器 115 | * 116 | * @param viewController 控制器 117 | * @param title 标题 118 | * @param imageName 图片 119 | * @param selectedImageName 选中图片 120 | */ 121 | 122 | - (void)addOneChildViewController:(UIViewController *)viewController WithTitle:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName{ 123 | 124 | viewController.view.backgroundColor = DWRandomColor; 125 | viewController.tabBarItem.title = title; 126 | viewController.tabBarItem.image = [UIImage imageNamed:imageName]; 127 | UIImage *image = [UIImage imageNamed:selectedImageName]; 128 | image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 129 | viewController.tabBarItem.selectedImage = image; 130 | [self addChildViewController:viewController]; 131 | 132 | } 133 | 134 | 135 | //这个方法可以抽取到 UIImage 的分类中 136 | - (UIImage *)imageWithColor:(UIColor *)color 137 | { 138 | NSParameterAssert(color != nil); 139 | 140 | CGRect rect = CGRectMake(0, 0, 1, 1); 141 | // Create a 1 by 1 pixel context 142 | UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0); 143 | [color setFill]; 144 | UIRectFill(rect); // Fill it with your color 145 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 146 | UIGraphicsEndImageContext(); 147 | 148 | return image; 149 | } 150 | 151 | 152 | @end 153 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Main/View/DWPublishButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // DWPublishButton.h 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DWPublishButton : UIButton 12 | 13 | +(instancetype)publishButton; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Main/View/DWPublishButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWPublishButton.m 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import "DWPublishButton.h" 10 | 11 | @interface DWPublishButton () 12 | 13 | @end 14 | 15 | @implementation DWPublishButton 16 | 17 | 18 | #pragma mark - 19 | #pragma mark - Private Methods 20 | 21 | //上下结构的 button 22 | - (void)layoutSubviews 23 | { 24 | [super layoutSubviews]; 25 | // 控件大小,间距大小 26 | CGFloat const imageViewEdge = self.bounds.size.width * 0.6; 27 | CGFloat const centerOfView = self.bounds.size.width * 0.5; 28 | CGFloat const labelLineHeight = self.titleLabel.font.lineHeight; 29 | CGFloat const verticalMarginT = self.bounds.size.height - labelLineHeight - imageViewEdge; 30 | CGFloat const verticalMargin = verticalMarginT / 2; 31 | 32 | // imageView 和 titleLabel 中心的 Y 值 33 | CGFloat const centerOfImageView = verticalMargin + imageViewEdge * 0.5; 34 | CGFloat const centerOfTitleLabel = imageViewEdge + verticalMargin * 2 + labelLineHeight * 0.5 + 5; 35 | //imageView position 位置 36 | 37 | self.imageView.bounds = CGRectMake(0, 0, imageViewEdge, imageViewEdge); 38 | self.imageView.center = CGPointMake(centerOfView, centerOfImageView); 39 | 40 | //title position 位置 41 | 42 | self.titleLabel.bounds = CGRectMake(0, 0, self.bounds.size.width, labelLineHeight); 43 | self.titleLabel.center = CGPointMake(centerOfView, centerOfTitleLabel); 44 | 45 | } 46 | 47 | #pragma mark - 48 | #pragma mark - Life Cycle 49 | 50 | -(instancetype)initWithFrame:(CGRect)frame{ 51 | 52 | if (self = [super initWithFrame:frame]) { 53 | self.titleLabel.textAlignment = NSTextAlignmentCenter; 54 | self.adjustsImageWhenHighlighted = NO; 55 | } 56 | 57 | return self; 58 | } 59 | 60 | #pragma mark - 61 | #pragma mark - Public Methods 62 | 63 | +(instancetype)publishButton{ 64 | 65 | DWPublishButton *button = [[DWPublishButton alloc]init]; 66 | 67 | [button setImage:[UIImage imageNamed:@"post_normal"] forState:UIControlStateNormal]; 68 | [button setTitle:@"发布" forState:UIControlStateNormal]; 69 | 70 | [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; 71 | button.titleLabel.font = [UIFont systemFontOfSize:9.5]; 72 | 73 | [button sizeToFit]; 74 | 75 | [button addTarget:button action:@selector(clickPublish) forControlEvents:UIControlEventTouchUpInside]; 76 | 77 | return button; 78 | 79 | } 80 | 81 | 82 | #pragma mark - 83 | #pragma mark - Event Response 84 | 85 | - (void)clickPublish { 86 | UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController; 87 | UIViewController *viewController = tabBarController.selectedViewController; 88 | 89 | UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:nil 90 | delegate:self 91 | cancelButtonTitle:@"取消" 92 | destructiveButtonTitle:nil 93 | otherButtonTitles:@"拍照", @"从相册选取", @"淘宝一键转卖", nil]; 94 | [actionSheet showInView:viewController.view]; 95 | } 96 | 97 | #pragma mark - UIActionSheetDelegate 98 | 99 | - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex { 100 | NSLog(@"buttonIndex = %ld", buttonIndex); 101 | } 102 | 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Main/View/DWTabBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // DWTabBar.h 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DWTabBar : UITabBar 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Main/View/DWTabBar.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWTabBar.m 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import "DWTabBar.h" 10 | 11 | #import "DWPublishButton.h" 12 | 13 | #define ButtonNumber 5 14 | 15 | 16 | @interface DWTabBar () 17 | 18 | @property (nonatomic, strong) DWPublishButton *publishButton;/**< 发布按钮 */ 19 | 20 | @end 21 | 22 | @implementation DWTabBar 23 | 24 | -(instancetype)initWithFrame:(CGRect)frame{ 25 | 26 | if (self = [super initWithFrame:frame]) { 27 | 28 | DWPublishButton *button = [DWPublishButton publishButton]; 29 | [self addSubview:button]; 30 | self.publishButton = button; 31 | 32 | } 33 | 34 | return self; 35 | } 36 | 37 | 38 | 39 | -(void)layoutSubviews{ 40 | 41 | 42 | NSLog(@"%s",__func__); 43 | 44 | [super layoutSubviews]; 45 | 46 | CGFloat barWidth = self.frame.size.width; 47 | CGFloat barHeight = self.frame.size.height; 48 | 49 | CGFloat buttonW = barWidth / ButtonNumber; 50 | CGFloat buttonH = barHeight - 2; 51 | CGFloat buttonY = 1; 52 | 53 | NSInteger buttonIndex = 0; 54 | 55 | self.publishButton.center = CGPointMake(barWidth * 0.5, barHeight * 0.3); 56 | 57 | for (UIView *view in self.subviews) { 58 | 59 | NSString *viewClass = NSStringFromClass([view class]); 60 | if (![viewClass isEqualToString:@"UITabBarButton"]) continue; 61 | 62 | CGFloat buttonX = buttonIndex * buttonW; 63 | if (buttonIndex >= 2) { // 右边2个按钮 64 | buttonX += buttonW; 65 | } 66 | 67 | view.frame = CGRectMake(buttonX, buttonY, buttonW, buttonH); 68 | 69 | 70 | buttonIndex ++; 71 | 72 | 73 | } 74 | } 75 | 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Message/DWMessageViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DWMessageViewController.h 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DWMessageViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Message/DWMessageViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWMessageViewController.m 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import "DWMessageViewController.h" 10 | 11 | @implementation DWMessageViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Mine/DWMineViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DWMineViewController.h 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DWMineViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/Mine/DWMineViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWMineViewController.m 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import "DWMineViewController.h" 10 | 11 | @implementation DWMineViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/SameCity/DWSameFityViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DWSameFityViewController.h 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DWSameFityViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/Classes/SameCity/DWSameFityViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWSameFityViewController.m 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. All rights reserved. 7 | // 8 | 9 | #import "DWSameFityViewController.h" 10 | 11 | @implementation DWSameFityViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /DWCustomTabBarDemo/DWCustomTabBarDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DWCustomTabBarDemo 4 | // 5 | // Created by Damon on 10/20/15. 6 | // Copyright © 2015 damonwong. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #基于 KVC 的 咸鱼 TabBar 模仿 2 | 3 | > 效果图如下 4 | 5 | 6 | 7 | ![image](http://ohe8u75p8.bkt.clouddn.com/DWTabBarController.gif) 8 | 9 | > 核心代码 10 | 11 | ```objc 12 | 13 | /** 14 | * 添加子控制器,我这里值添加了4个,没有占位自控制器 15 | */ 16 | - (void)setUpChildViewController{ 17 | 18 | [self addOneChildViewController:[[UINavigationController alloc]initWithRootViewController:[[DWHomeViewController alloc]init]] 19 | WithTitle:@"首页" 20 | imageName:@"home_normal" 21 | selectedImageName:@"home_highlight"]; 22 | 23 | [self addOneChildViewController:[[UINavigationController alloc]initWithRootViewController:[[DWSameFityViewController alloc] init]] 24 | WithTitle:@"同城" 25 | imageName:@"mycity_normal" 26 | selectedImageName:@"mycity_highlight"]; 27 | 28 | 29 | [self addOneChildViewController:[[UINavigationController alloc]initWithRootViewController:[[DWMessageViewController alloc]init]] 30 | WithTitle:@"消息" 31 | imageName:@"message_normal" 32 | selectedImageName:@"message_highlight"]; 33 | 34 | 35 | [self addOneChildViewController:[[UINavigationController alloc]initWithRootViewController:[[DWMineViewController alloc]init]] 36 | WithTitle:@"我的" 37 | imageName:@"account_normal" 38 | selectedImageName:@"account_highlight"]; 39 | 40 | } 41 | 42 | /** 43 | * 添加一个子控制器 44 | * 45 | * @param viewController 控制器 46 | * @param title 标题 47 | * @param imageName 图片 48 | * @param selectedImageName 选中图片 49 | */ 50 | 51 | - (void)addOneChildViewController:(UIViewController *)viewController WithTitle:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName{ 52 | 53 | viewController.view.backgroundColor = DWRandomColor; 54 | viewController.tabBarItem.title = title; 55 | viewController.tabBarItem.image = [UIImage imageNamed:imageName]; 56 | UIImage *image = [UIImage imageNamed:selectedImageName]; 57 | image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 58 | viewController.tabBarItem.selectedImage = image; 59 | [self addChildViewController:viewController]; 60 | 61 | } 62 | 63 | 64 | ``` 65 | 66 | > 只加了4个控制器,但是有5个按钮。 67 | > 基于系统自带,重新布局,没有完全自定义 68 | 69 | 70 | --------------------------------------------------------------------------------