├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── MDCSampleApp ├── MDCSampleApp.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── MDCSampleApp │ ├── Controllers │ │ ├── MDCEmbeddedTableViewController.h │ │ ├── MDCEmbeddedTableViewController.m │ │ ├── MDCRootViewController.h │ │ ├── MDCRootViewController.m │ │ ├── MDCTableViewController.h │ │ └── MDCTableViewController.m │ ├── Delegate │ │ ├── MDCAppDelegate.h │ │ └── MDCAppDelegate.m │ ├── MDCSampleApp-Info.plist │ ├── MDCSampleApp-Prefix.pch │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m └── MDCSampleAppTests │ ├── MDCSampleAppTests-Info.plist │ ├── MDCSampleAppTests.h │ ├── MDCSampleAppTests.m │ └── en.lproj │ └── InfoPlist.strings ├── MDCScrollBarLabel.h ├── MDCScrollBarLabel.m ├── MDCScrollBarLabel.podspec ├── MDCScrollBarLabel.xcworkspace └── contents.xcworkspacedata ├── MDCScrollBarViewController.h ├── MDCScrollBarViewController.m ├── README.md └── Resources └── Images ├── clock-center.png ├── clock-center@2x.png ├── clock-face.png ├── clock-face@2x.png ├── clock-hour-hand.png ├── clock-hour-hand@2x.png ├── clock-minute-hand.png ├── clock-minute-hand@2x.png ├── label-background.png └── label-background@2x.png /.gitignore: -------------------------------------------------------------------------------- 1 | xcuserdata 2 | .DS_Store 3 | *.xccheckout 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [v0.1.1](https://github.com/modocache/MDCScrollBarLabel/compare/v0.1.0...v0.1.1) 2 | 3 | ###### Bug Fixes 4 | 5 | - Added resources to podspec. 6 | 7 | 8 | ## v0.1.0 9 | 10 | ###### Enhancements 11 | 12 | - Added podspec. 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 modocache 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DA2785EC15DC9EC3005FD9DF /* MDCEmbeddedTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA2785EB15DC9EC3005FD9DF /* MDCEmbeddedTableViewController.m */; }; 11 | DA37439215E1BCA6006FFAAC /* clock-center.png in Resources */ = {isa = PBXBuildFile; fileRef = DA37438815E1BCA6006FFAAC /* clock-center.png */; }; 12 | DA37439315E1BCA6006FFAAC /* clock-center@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA37438915E1BCA6006FFAAC /* clock-center@2x.png */; }; 13 | DA37439415E1BCA6006FFAAC /* clock-face.png in Resources */ = {isa = PBXBuildFile; fileRef = DA37438A15E1BCA6006FFAAC /* clock-face.png */; }; 14 | DA37439515E1BCA6006FFAAC /* clock-face@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA37438B15E1BCA6006FFAAC /* clock-face@2x.png */; }; 15 | DA37439615E1BCA6006FFAAC /* clock-hour-hand.png in Resources */ = {isa = PBXBuildFile; fileRef = DA37438C15E1BCA6006FFAAC /* clock-hour-hand.png */; }; 16 | DA37439715E1BCA6006FFAAC /* clock-hour-hand@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA37438D15E1BCA6006FFAAC /* clock-hour-hand@2x.png */; }; 17 | DA37439815E1BCA6006FFAAC /* clock-minute-hand.png in Resources */ = {isa = PBXBuildFile; fileRef = DA37438E15E1BCA6006FFAAC /* clock-minute-hand.png */; }; 18 | DA37439915E1BCA6006FFAAC /* clock-minute-hand@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA37438F15E1BCA6006FFAAC /* clock-minute-hand@2x.png */; }; 19 | DA37439A15E1BCA6006FFAAC /* label-background.png in Resources */ = {isa = PBXBuildFile; fileRef = DA37439015E1BCA6006FFAAC /* label-background.png */; }; 20 | DA37439B15E1BCA6006FFAAC /* label-background@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA37439115E1BCA6006FFAAC /* label-background@2x.png */; }; 21 | DA3B9930150B885D00F8A02E /* MDCScrollBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA3B992F150B885D00F8A02E /* MDCScrollBarViewController.m */; }; 22 | DA3B9931150B885D00F8A02E /* MDCScrollBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA3B992F150B885D00F8A02E /* MDCScrollBarViewController.m */; }; 23 | DA7B95F4150A8B7D00800EF2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA7B95F3150A8B7D00800EF2 /* UIKit.framework */; }; 24 | DA7B95F6150A8B7D00800EF2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA7B95F5150A8B7D00800EF2 /* Foundation.framework */; }; 25 | DA7B95F8150A8B7D00800EF2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA7B95F7150A8B7D00800EF2 /* CoreGraphics.framework */; }; 26 | DA7B95FE150A8B7D00800EF2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA7B95FC150A8B7D00800EF2 /* InfoPlist.strings */; }; 27 | DA7B9600150A8B7D00800EF2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7B95FF150A8B7D00800EF2 /* main.m */; }; 28 | DA7B960C150A8B7D00800EF2 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA7B960B150A8B7D00800EF2 /* SenTestingKit.framework */; }; 29 | DA7B960D150A8B7D00800EF2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA7B95F3150A8B7D00800EF2 /* UIKit.framework */; }; 30 | DA7B960E150A8B7D00800EF2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA7B95F5150A8B7D00800EF2 /* Foundation.framework */; }; 31 | DA7B9616150A8B7D00800EF2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA7B9614150A8B7D00800EF2 /* InfoPlist.strings */; }; 32 | DA7B9619150A8B7D00800EF2 /* MDCSampleAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7B9618150A8B7D00800EF2 /* MDCSampleAppTests.m */; }; 33 | DA7B9638150A8D5900800EF2 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA7B9637150A8D5800800EF2 /* QuartzCore.framework */; }; 34 | DA7B965C150B5A0300800EF2 /* MDCScrollBarLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7B965B150B5A0300800EF2 /* MDCScrollBarLabel.m */; }; 35 | DA7B965D150B5A0300800EF2 /* MDCScrollBarLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7B965B150B5A0300800EF2 /* MDCScrollBarLabel.m */; }; 36 | DA7B9678150B618100800EF2 /* MDCRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7B966D150B618100800EF2 /* MDCRootViewController.m */; }; 37 | DA7B9679150B618100800EF2 /* MDCRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7B966D150B618100800EF2 /* MDCRootViewController.m */; }; 38 | DA7B9680150B618100800EF2 /* MDCAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7B9677150B618100800EF2 /* MDCAppDelegate.m */; }; 39 | DA7B9681150B618100800EF2 /* MDCAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7B9677150B618100800EF2 /* MDCAppDelegate.m */; }; 40 | DA7B968A150B692300800EF2 /* MDCTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7B9689150B692200800EF2 /* MDCTableViewController.m */; }; 41 | DA7B968B150B692300800EF2 /* MDCTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA7B9689150B692200800EF2 /* MDCTableViewController.m */; }; 42 | /* End PBXBuildFile section */ 43 | 44 | /* Begin PBXContainerItemProxy section */ 45 | DA7B960F150A8B7D00800EF2 /* PBXContainerItemProxy */ = { 46 | isa = PBXContainerItemProxy; 47 | containerPortal = DA7B95E6150A8B7D00800EF2 /* Project object */; 48 | proxyType = 1; 49 | remoteGlobalIDString = DA7B95EE150A8B7D00800EF2; 50 | remoteInfo = MDCSampleApp; 51 | }; 52 | /* End PBXContainerItemProxy section */ 53 | 54 | /* Begin PBXFileReference section */ 55 | DA2785EA15DC9EC3005FD9DF /* MDCEmbeddedTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MDCEmbeddedTableViewController.h; sourceTree = ""; }; 56 | DA2785EB15DC9EC3005FD9DF /* MDCEmbeddedTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MDCEmbeddedTableViewController.m; sourceTree = ""; }; 57 | DA37438815E1BCA6006FFAAC /* clock-center.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock-center.png"; sourceTree = ""; }; 58 | DA37438915E1BCA6006FFAAC /* clock-center@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock-center@2x.png"; sourceTree = ""; }; 59 | DA37438A15E1BCA6006FFAAC /* clock-face.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock-face.png"; sourceTree = ""; }; 60 | DA37438B15E1BCA6006FFAAC /* clock-face@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock-face@2x.png"; sourceTree = ""; }; 61 | DA37438C15E1BCA6006FFAAC /* clock-hour-hand.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock-hour-hand.png"; sourceTree = ""; }; 62 | DA37438D15E1BCA6006FFAAC /* clock-hour-hand@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock-hour-hand@2x.png"; sourceTree = ""; }; 63 | DA37438E15E1BCA6006FFAAC /* clock-minute-hand.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock-minute-hand.png"; sourceTree = ""; }; 64 | DA37438F15E1BCA6006FFAAC /* clock-minute-hand@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock-minute-hand@2x.png"; sourceTree = ""; }; 65 | DA37439015E1BCA6006FFAAC /* label-background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "label-background.png"; sourceTree = ""; }; 66 | DA37439115E1BCA6006FFAAC /* label-background@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "label-background@2x.png"; sourceTree = ""; }; 67 | DA3B992E150B885D00F8A02E /* MDCScrollBarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MDCScrollBarViewController.h; path = ../../MDCScrollBarViewController.h; sourceTree = ""; }; 68 | DA3B992F150B885D00F8A02E /* MDCScrollBarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MDCScrollBarViewController.m; path = ../../MDCScrollBarViewController.m; sourceTree = ""; }; 69 | DA7B95EF150A8B7D00800EF2 /* MDCSampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MDCSampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 70 | DA7B95F3150A8B7D00800EF2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 71 | DA7B95F5150A8B7D00800EF2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 72 | DA7B95F7150A8B7D00800EF2 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 73 | DA7B95FB150A8B7D00800EF2 /* MDCSampleApp-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MDCSampleApp-Info.plist"; sourceTree = ""; }; 74 | DA7B95FD150A8B7D00800EF2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 75 | DA7B95FF150A8B7D00800EF2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 76 | DA7B960A150A8B7D00800EF2 /* MDCSampleAppTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MDCSampleAppTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; 77 | DA7B960B150A8B7D00800EF2 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; 78 | DA7B9613150A8B7D00800EF2 /* MDCSampleAppTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MDCSampleAppTests-Info.plist"; sourceTree = ""; }; 79 | DA7B9615150A8B7D00800EF2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 80 | DA7B9617150A8B7D00800EF2 /* MDCSampleAppTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MDCSampleAppTests.h; sourceTree = ""; }; 81 | DA7B9618150A8B7D00800EF2 /* MDCSampleAppTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MDCSampleAppTests.m; sourceTree = ""; }; 82 | DA7B9637150A8D5800800EF2 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 83 | DA7B965A150B5A0300800EF2 /* MDCScrollBarLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MDCScrollBarLabel.h; path = ../../MDCScrollBarLabel.h; sourceTree = ""; }; 84 | DA7B965B150B5A0300800EF2 /* MDCScrollBarLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MDCScrollBarLabel.m; path = ../../MDCScrollBarLabel.m; sourceTree = ""; }; 85 | DA7B966C150B618100800EF2 /* MDCRootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MDCRootViewController.h; sourceTree = ""; }; 86 | DA7B966D150B618100800EF2 /* MDCRootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MDCRootViewController.m; sourceTree = ""; }; 87 | DA7B9676150B618100800EF2 /* MDCAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MDCAppDelegate.h; sourceTree = ""; }; 88 | DA7B9677150B618100800EF2 /* MDCAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MDCAppDelegate.m; sourceTree = ""; }; 89 | DA7B9687150B622C00800EF2 /* MDCSampleApp-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MDCSampleApp-Prefix.pch"; sourceTree = ""; }; 90 | DA7B9688150B692200800EF2 /* MDCTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MDCTableViewController.h; sourceTree = ""; }; 91 | DA7B9689150B692200800EF2 /* MDCTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MDCTableViewController.m; sourceTree = ""; }; 92 | /* End PBXFileReference section */ 93 | 94 | /* Begin PBXFrameworksBuildPhase section */ 95 | DA7B95EC150A8B7D00800EF2 /* Frameworks */ = { 96 | isa = PBXFrameworksBuildPhase; 97 | buildActionMask = 2147483647; 98 | files = ( 99 | DA7B9638150A8D5900800EF2 /* QuartzCore.framework in Frameworks */, 100 | DA7B95F4150A8B7D00800EF2 /* UIKit.framework in Frameworks */, 101 | DA7B95F6150A8B7D00800EF2 /* Foundation.framework in Frameworks */, 102 | DA7B95F8150A8B7D00800EF2 /* CoreGraphics.framework in Frameworks */, 103 | ); 104 | runOnlyForDeploymentPostprocessing = 0; 105 | }; 106 | DA7B9606150A8B7D00800EF2 /* Frameworks */ = { 107 | isa = PBXFrameworksBuildPhase; 108 | buildActionMask = 2147483647; 109 | files = ( 110 | DA7B960C150A8B7D00800EF2 /* SenTestingKit.framework in Frameworks */, 111 | DA7B960D150A8B7D00800EF2 /* UIKit.framework in Frameworks */, 112 | DA7B960E150A8B7D00800EF2 /* Foundation.framework in Frameworks */, 113 | ); 114 | runOnlyForDeploymentPostprocessing = 0; 115 | }; 116 | /* End PBXFrameworksBuildPhase section */ 117 | 118 | /* Begin PBXGroup section */ 119 | DA37438615E1BCA6006FFAAC /* Resources */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | DA37438715E1BCA6006FFAAC /* Images */, 123 | ); 124 | name = Resources; 125 | path = ../../Resources; 126 | sourceTree = ""; 127 | }; 128 | DA37438715E1BCA6006FFAAC /* Images */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | DA37438815E1BCA6006FFAAC /* clock-center.png */, 132 | DA37438915E1BCA6006FFAAC /* clock-center@2x.png */, 133 | DA37438A15E1BCA6006FFAAC /* clock-face.png */, 134 | DA37438B15E1BCA6006FFAAC /* clock-face@2x.png */, 135 | DA37438C15E1BCA6006FFAAC /* clock-hour-hand.png */, 136 | DA37438D15E1BCA6006FFAAC /* clock-hour-hand@2x.png */, 137 | DA37438E15E1BCA6006FFAAC /* clock-minute-hand.png */, 138 | DA37438F15E1BCA6006FFAAC /* clock-minute-hand@2x.png */, 139 | DA37439015E1BCA6006FFAAC /* label-background.png */, 140 | DA37439115E1BCA6006FFAAC /* label-background@2x.png */, 141 | ); 142 | path = Images; 143 | sourceTree = ""; 144 | }; 145 | DA7B95E4150A8B7D00800EF2 = { 146 | isa = PBXGroup; 147 | children = ( 148 | DA7B95F9150A8B7D00800EF2 /* MDCSampleApp */, 149 | DA7B9611150A8B7D00800EF2 /* MDCSampleAppTests */, 150 | DA7B95F2150A8B7D00800EF2 /* Frameworks */, 151 | DA7B95F0150A8B7D00800EF2 /* Products */, 152 | ); 153 | sourceTree = ""; 154 | }; 155 | DA7B95F0150A8B7D00800EF2 /* Products */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | DA7B95EF150A8B7D00800EF2 /* MDCSampleApp.app */, 159 | DA7B960A150A8B7D00800EF2 /* MDCSampleAppTests.octest */, 160 | ); 161 | name = Products; 162 | sourceTree = ""; 163 | }; 164 | DA7B95F2150A8B7D00800EF2 /* Frameworks */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | DA7B9637150A8D5800800EF2 /* QuartzCore.framework */, 168 | DA7B95F3150A8B7D00800EF2 /* UIKit.framework */, 169 | DA7B95F5150A8B7D00800EF2 /* Foundation.framework */, 170 | DA7B95F7150A8B7D00800EF2 /* CoreGraphics.framework */, 171 | DA7B960B150A8B7D00800EF2 /* SenTestingKit.framework */, 172 | ); 173 | name = Frameworks; 174 | sourceTree = ""; 175 | }; 176 | DA7B95F9150A8B7D00800EF2 /* MDCSampleApp */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | DA37438615E1BCA6006FFAAC /* Resources */, 180 | DA7B966B150B618100800EF2 /* Controllers */, 181 | DA7B9675150B618100800EF2 /* Delegate */, 182 | DA7B95FA150A8B7D00800EF2 /* Supporting Files */, 183 | DA7B965A150B5A0300800EF2 /* MDCScrollBarLabel.h */, 184 | DA7B965B150B5A0300800EF2 /* MDCScrollBarLabel.m */, 185 | DA3B992E150B885D00F8A02E /* MDCScrollBarViewController.h */, 186 | DA3B992F150B885D00F8A02E /* MDCScrollBarViewController.m */, 187 | ); 188 | path = MDCSampleApp; 189 | sourceTree = ""; 190 | }; 191 | DA7B95FA150A8B7D00800EF2 /* Supporting Files */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | DA7B9687150B622C00800EF2 /* MDCSampleApp-Prefix.pch */, 195 | DA7B95FB150A8B7D00800EF2 /* MDCSampleApp-Info.plist */, 196 | DA7B95FC150A8B7D00800EF2 /* InfoPlist.strings */, 197 | DA7B95FF150A8B7D00800EF2 /* main.m */, 198 | ); 199 | name = "Supporting Files"; 200 | sourceTree = ""; 201 | }; 202 | DA7B9611150A8B7D00800EF2 /* MDCSampleAppTests */ = { 203 | isa = PBXGroup; 204 | children = ( 205 | DA7B9617150A8B7D00800EF2 /* MDCSampleAppTests.h */, 206 | DA7B9618150A8B7D00800EF2 /* MDCSampleAppTests.m */, 207 | DA7B9612150A8B7D00800EF2 /* Supporting Files */, 208 | ); 209 | path = MDCSampleAppTests; 210 | sourceTree = ""; 211 | }; 212 | DA7B9612150A8B7D00800EF2 /* Supporting Files */ = { 213 | isa = PBXGroup; 214 | children = ( 215 | DA7B9613150A8B7D00800EF2 /* MDCSampleAppTests-Info.plist */, 216 | DA7B9614150A8B7D00800EF2 /* InfoPlist.strings */, 217 | ); 218 | name = "Supporting Files"; 219 | sourceTree = ""; 220 | }; 221 | DA7B966B150B618100800EF2 /* Controllers */ = { 222 | isa = PBXGroup; 223 | children = ( 224 | DA7B966C150B618100800EF2 /* MDCRootViewController.h */, 225 | DA7B966D150B618100800EF2 /* MDCRootViewController.m */, 226 | DA7B9688150B692200800EF2 /* MDCTableViewController.h */, 227 | DA7B9689150B692200800EF2 /* MDCTableViewController.m */, 228 | DA2785EA15DC9EC3005FD9DF /* MDCEmbeddedTableViewController.h */, 229 | DA2785EB15DC9EC3005FD9DF /* MDCEmbeddedTableViewController.m */, 230 | ); 231 | path = Controllers; 232 | sourceTree = ""; 233 | }; 234 | DA7B9675150B618100800EF2 /* Delegate */ = { 235 | isa = PBXGroup; 236 | children = ( 237 | DA7B9676150B618100800EF2 /* MDCAppDelegate.h */, 238 | DA7B9677150B618100800EF2 /* MDCAppDelegate.m */, 239 | ); 240 | path = Delegate; 241 | sourceTree = ""; 242 | }; 243 | /* End PBXGroup section */ 244 | 245 | /* Begin PBXNativeTarget section */ 246 | DA7B95EE150A8B7D00800EF2 /* MDCSampleApp */ = { 247 | isa = PBXNativeTarget; 248 | buildConfigurationList = DA7B961C150A8B7D00800EF2 /* Build configuration list for PBXNativeTarget "MDCSampleApp" */; 249 | buildPhases = ( 250 | DA7B95EB150A8B7D00800EF2 /* Sources */, 251 | DA7B95EC150A8B7D00800EF2 /* Frameworks */, 252 | DA7B95ED150A8B7D00800EF2 /* Resources */, 253 | ); 254 | buildRules = ( 255 | ); 256 | dependencies = ( 257 | ); 258 | name = MDCSampleApp; 259 | productName = MDCSampleApp; 260 | productReference = DA7B95EF150A8B7D00800EF2 /* MDCSampleApp.app */; 261 | productType = "com.apple.product-type.application"; 262 | }; 263 | DA7B9609150A8B7D00800EF2 /* MDCSampleAppTests */ = { 264 | isa = PBXNativeTarget; 265 | buildConfigurationList = DA7B961F150A8B7D00800EF2 /* Build configuration list for PBXNativeTarget "MDCSampleAppTests" */; 266 | buildPhases = ( 267 | DA7B9605150A8B7D00800EF2 /* Sources */, 268 | DA7B9606150A8B7D00800EF2 /* Frameworks */, 269 | DA7B9607150A8B7D00800EF2 /* Resources */, 270 | DA7B9608150A8B7D00800EF2 /* ShellScript */, 271 | ); 272 | buildRules = ( 273 | ); 274 | dependencies = ( 275 | DA7B9610150A8B7D00800EF2 /* PBXTargetDependency */, 276 | ); 277 | name = MDCSampleAppTests; 278 | productName = MDCSampleAppTests; 279 | productReference = DA7B960A150A8B7D00800EF2 /* MDCSampleAppTests.octest */; 280 | productType = "com.apple.product-type.bundle"; 281 | }; 282 | /* End PBXNativeTarget section */ 283 | 284 | /* Begin PBXProject section */ 285 | DA7B95E6150A8B7D00800EF2 /* Project object */ = { 286 | isa = PBXProject; 287 | attributes = { 288 | LastUpgradeCheck = 0440; 289 | }; 290 | buildConfigurationList = DA7B95E9150A8B7D00800EF2 /* Build configuration list for PBXProject "MDCSampleApp" */; 291 | compatibilityVersion = "Xcode 3.2"; 292 | developmentRegion = English; 293 | hasScannedForEncodings = 0; 294 | knownRegions = ( 295 | en, 296 | ); 297 | mainGroup = DA7B95E4150A8B7D00800EF2; 298 | productRefGroup = DA7B95F0150A8B7D00800EF2 /* Products */; 299 | projectDirPath = ""; 300 | projectRoot = ""; 301 | targets = ( 302 | DA7B95EE150A8B7D00800EF2 /* MDCSampleApp */, 303 | DA7B9609150A8B7D00800EF2 /* MDCSampleAppTests */, 304 | ); 305 | }; 306 | /* End PBXProject section */ 307 | 308 | /* Begin PBXResourcesBuildPhase section */ 309 | DA7B95ED150A8B7D00800EF2 /* Resources */ = { 310 | isa = PBXResourcesBuildPhase; 311 | buildActionMask = 2147483647; 312 | files = ( 313 | DA7B95FE150A8B7D00800EF2 /* InfoPlist.strings in Resources */, 314 | DA37439215E1BCA6006FFAAC /* clock-center.png in Resources */, 315 | DA37439315E1BCA6006FFAAC /* clock-center@2x.png in Resources */, 316 | DA37439415E1BCA6006FFAAC /* clock-face.png in Resources */, 317 | DA37439515E1BCA6006FFAAC /* clock-face@2x.png in Resources */, 318 | DA37439615E1BCA6006FFAAC /* clock-hour-hand.png in Resources */, 319 | DA37439715E1BCA6006FFAAC /* clock-hour-hand@2x.png in Resources */, 320 | DA37439815E1BCA6006FFAAC /* clock-minute-hand.png in Resources */, 321 | DA37439915E1BCA6006FFAAC /* clock-minute-hand@2x.png in Resources */, 322 | DA37439A15E1BCA6006FFAAC /* label-background.png in Resources */, 323 | DA37439B15E1BCA6006FFAAC /* label-background@2x.png in Resources */, 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | }; 327 | DA7B9607150A8B7D00800EF2 /* Resources */ = { 328 | isa = PBXResourcesBuildPhase; 329 | buildActionMask = 2147483647; 330 | files = ( 331 | DA7B9616150A8B7D00800EF2 /* InfoPlist.strings in Resources */, 332 | ); 333 | runOnlyForDeploymentPostprocessing = 0; 334 | }; 335 | /* End PBXResourcesBuildPhase section */ 336 | 337 | /* Begin PBXShellScriptBuildPhase section */ 338 | DA7B9608150A8B7D00800EF2 /* ShellScript */ = { 339 | isa = PBXShellScriptBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | ); 343 | inputPaths = ( 344 | ); 345 | outputPaths = ( 346 | ); 347 | runOnlyForDeploymentPostprocessing = 0; 348 | shellPath = /bin/sh; 349 | shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; 350 | }; 351 | /* End PBXShellScriptBuildPhase section */ 352 | 353 | /* Begin PBXSourcesBuildPhase section */ 354 | DA7B95EB150A8B7D00800EF2 /* Sources */ = { 355 | isa = PBXSourcesBuildPhase; 356 | buildActionMask = 2147483647; 357 | files = ( 358 | DA7B9600150A8B7D00800EF2 /* main.m in Sources */, 359 | DA7B965C150B5A0300800EF2 /* MDCScrollBarLabel.m in Sources */, 360 | DA7B9678150B618100800EF2 /* MDCRootViewController.m in Sources */, 361 | DA7B9680150B618100800EF2 /* MDCAppDelegate.m in Sources */, 362 | DA7B968A150B692300800EF2 /* MDCTableViewController.m in Sources */, 363 | DA3B9930150B885D00F8A02E /* MDCScrollBarViewController.m in Sources */, 364 | DA2785EC15DC9EC3005FD9DF /* MDCEmbeddedTableViewController.m in Sources */, 365 | ); 366 | runOnlyForDeploymentPostprocessing = 0; 367 | }; 368 | DA7B9605150A8B7D00800EF2 /* Sources */ = { 369 | isa = PBXSourcesBuildPhase; 370 | buildActionMask = 2147483647; 371 | files = ( 372 | DA7B9619150A8B7D00800EF2 /* MDCSampleAppTests.m in Sources */, 373 | DA7B965D150B5A0300800EF2 /* MDCScrollBarLabel.m in Sources */, 374 | DA7B9679150B618100800EF2 /* MDCRootViewController.m in Sources */, 375 | DA7B9681150B618100800EF2 /* MDCAppDelegate.m in Sources */, 376 | DA7B968B150B692300800EF2 /* MDCTableViewController.m in Sources */, 377 | DA3B9931150B885D00F8A02E /* MDCScrollBarViewController.m in Sources */, 378 | ); 379 | runOnlyForDeploymentPostprocessing = 0; 380 | }; 381 | /* End PBXSourcesBuildPhase section */ 382 | 383 | /* Begin PBXTargetDependency section */ 384 | DA7B9610150A8B7D00800EF2 /* PBXTargetDependency */ = { 385 | isa = PBXTargetDependency; 386 | target = DA7B95EE150A8B7D00800EF2 /* MDCSampleApp */; 387 | targetProxy = DA7B960F150A8B7D00800EF2 /* PBXContainerItemProxy */; 388 | }; 389 | /* End PBXTargetDependency section */ 390 | 391 | /* Begin PBXVariantGroup section */ 392 | DA7B95FC150A8B7D00800EF2 /* InfoPlist.strings */ = { 393 | isa = PBXVariantGroup; 394 | children = ( 395 | DA7B95FD150A8B7D00800EF2 /* en */, 396 | ); 397 | name = InfoPlist.strings; 398 | sourceTree = ""; 399 | }; 400 | DA7B9614150A8B7D00800EF2 /* InfoPlist.strings */ = { 401 | isa = PBXVariantGroup; 402 | children = ( 403 | DA7B9615150A8B7D00800EF2 /* en */, 404 | ); 405 | name = InfoPlist.strings; 406 | sourceTree = ""; 407 | }; 408 | /* End PBXVariantGroup section */ 409 | 410 | /* Begin XCBuildConfiguration section */ 411 | DA7B961A150A8B7D00800EF2 /* Debug */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | ALWAYS_SEARCH_USER_PATHS = NO; 415 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 417 | COPY_PHASE_STRIP = NO; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_DYNAMIC_NO_PIC = NO; 420 | GCC_OPTIMIZATION_LEVEL = 0; 421 | GCC_PREPROCESSOR_DEFINITIONS = ( 422 | "DEBUG=1", 423 | "$(inherited)", 424 | ); 425 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 426 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 427 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 428 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 431 | SDKROOT = iphoneos; 432 | TARGETED_DEVICE_FAMILY = "1,2"; 433 | }; 434 | name = Debug; 435 | }; 436 | DA7B961B150A8B7D00800EF2 /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | ALWAYS_SEARCH_USER_PATHS = NO; 440 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 441 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 442 | COPY_PHASE_STRIP = YES; 443 | GCC_C_LANGUAGE_STANDARD = gnu99; 444 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 445 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 446 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 447 | GCC_WARN_UNUSED_VARIABLE = YES; 448 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 449 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 450 | SDKROOT = iphoneos; 451 | TARGETED_DEVICE_FAMILY = "1,2"; 452 | VALIDATE_PRODUCT = YES; 453 | }; 454 | name = Release; 455 | }; 456 | DA7B961D150A8B7D00800EF2 /* Debug */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | CLANG_ENABLE_OBJC_ARC = YES; 460 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 461 | GCC_PREFIX_HEADER = "MDCSampleApp/MDCSampleApp-Prefix.pch"; 462 | INFOPLIST_FILE = "MDCSampleApp/MDCSampleApp-Info.plist"; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | WRAPPER_EXTENSION = app; 465 | }; 466 | name = Debug; 467 | }; 468 | DA7B961E150A8B7D00800EF2 /* Release */ = { 469 | isa = XCBuildConfiguration; 470 | buildSettings = { 471 | CLANG_ENABLE_OBJC_ARC = YES; 472 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 473 | GCC_PREFIX_HEADER = "MDCSampleApp/MDCSampleApp-Prefix.pch"; 474 | INFOPLIST_FILE = "MDCSampleApp/MDCSampleApp-Info.plist"; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | WRAPPER_EXTENSION = app; 477 | }; 478 | name = Release; 479 | }; 480 | DA7B9620150A8B7D00800EF2 /* Debug */ = { 481 | isa = XCBuildConfiguration; 482 | buildSettings = { 483 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/MDCSampleApp.app/MDCSampleApp"; 484 | CLANG_ENABLE_OBJC_ARC = YES; 485 | FRAMEWORK_SEARCH_PATHS = ( 486 | "$(SDKROOT)/Developer/Library/Frameworks", 487 | "$(DEVELOPER_LIBRARY_DIR)/Frameworks", 488 | ); 489 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 490 | GCC_PREFIX_HEADER = "MDCSampleApp/MDCSampleApp-Prefix.pch"; 491 | INFOPLIST_FILE = "MDCSampleAppTests/MDCSampleAppTests-Info.plist"; 492 | PRODUCT_NAME = "$(TARGET_NAME)"; 493 | TEST_HOST = "$(BUNDLE_LOADER)"; 494 | WRAPPER_EXTENSION = octest; 495 | }; 496 | name = Debug; 497 | }; 498 | DA7B9621150A8B7D00800EF2 /* Release */ = { 499 | isa = XCBuildConfiguration; 500 | buildSettings = { 501 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/MDCSampleApp.app/MDCSampleApp"; 502 | CLANG_ENABLE_OBJC_ARC = YES; 503 | FRAMEWORK_SEARCH_PATHS = ( 504 | "$(SDKROOT)/Developer/Library/Frameworks", 505 | "$(DEVELOPER_LIBRARY_DIR)/Frameworks", 506 | ); 507 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 508 | GCC_PREFIX_HEADER = "MDCSampleApp/MDCSampleApp-Prefix.pch"; 509 | INFOPLIST_FILE = "MDCSampleAppTests/MDCSampleAppTests-Info.plist"; 510 | PRODUCT_NAME = "$(TARGET_NAME)"; 511 | TEST_HOST = "$(BUNDLE_LOADER)"; 512 | WRAPPER_EXTENSION = octest; 513 | }; 514 | name = Release; 515 | }; 516 | /* End XCBuildConfiguration section */ 517 | 518 | /* Begin XCConfigurationList section */ 519 | DA7B95E9150A8B7D00800EF2 /* Build configuration list for PBXProject "MDCSampleApp" */ = { 520 | isa = XCConfigurationList; 521 | buildConfigurations = ( 522 | DA7B961A150A8B7D00800EF2 /* Debug */, 523 | DA7B961B150A8B7D00800EF2 /* Release */, 524 | ); 525 | defaultConfigurationIsVisible = 0; 526 | defaultConfigurationName = Release; 527 | }; 528 | DA7B961C150A8B7D00800EF2 /* Build configuration list for PBXNativeTarget "MDCSampleApp" */ = { 529 | isa = XCConfigurationList; 530 | buildConfigurations = ( 531 | DA7B961D150A8B7D00800EF2 /* Debug */, 532 | DA7B961E150A8B7D00800EF2 /* Release */, 533 | ); 534 | defaultConfigurationIsVisible = 0; 535 | defaultConfigurationName = Release; 536 | }; 537 | DA7B961F150A8B7D00800EF2 /* Build configuration list for PBXNativeTarget "MDCSampleAppTests" */ = { 538 | isa = XCConfigurationList; 539 | buildConfigurations = ( 540 | DA7B9620150A8B7D00800EF2 /* Debug */, 541 | DA7B9621150A8B7D00800EF2 /* Release */, 542 | ); 543 | defaultConfigurationIsVisible = 0; 544 | defaultConfigurationName = Release; 545 | }; 546 | /* End XCConfigurationList section */ 547 | }; 548 | rootObject = DA7B95E6150A8B7D00800EF2 /* Project object */; 549 | } 550 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/Controllers/MDCEmbeddedTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import 26 | #import "MDCTableViewController.h" 27 | 28 | 29 | @interface MDCEmbeddedTableViewController : MDCTableViewController 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/Controllers/MDCEmbeddedTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import "MDCEmbeddedTableViewController.h" 26 | 27 | 28 | static CGFloat const kMDCTableViewPadding = 35.0f; 29 | 30 | 31 | @interface MDCEmbeddedTableViewController () 32 | @property (nonatomic, strong) UIScrollView *scrollView; 33 | @end 34 | 35 | 36 | @implementation MDCEmbeddedTableViewController 37 | 38 | 39 | #pragma mark - UIViewController Overrides 40 | 41 | - (void)viewDidLoad 42 | { 43 | [super viewDidLoad]; 44 | self.title = NSLocalizedString(@"Embedded UITableView", nil); 45 | self.view.backgroundColor = [UIColor darkGrayColor]; 46 | self.tableView.frame = CGRectMake(kMDCTableViewPadding, 47 | kMDCTableViewPadding, 48 | self.view.frame.size.width - kMDCTableViewPadding * 2, 49 | self.view.frame.size.height - kMDCTableViewPadding * 2); 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/Controllers/MDCRootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import 26 | 27 | 28 | @interface MDCRootViewController : UITableViewController 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/Controllers/MDCRootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import "MDCRootViewController.h" 26 | 27 | #import "MDCEmbeddedTableViewController.h" 28 | #import "MDCTableViewController.h" 29 | 30 | 31 | typedef enum { 32 | MDCRootViewControllerCellTagUITableView = 0, 33 | MDCRootViewControllerCellTagEmbeddedUITableView 34 | } MDCRootViewControllerCellTag; 35 | 36 | 37 | @implementation MDCRootViewController 38 | 39 | 40 | #pragma mark - Object Lifecycle 41 | 42 | - (id)init 43 | { 44 | return [super initWithStyle:UITableViewStylePlain]; 45 | } 46 | 47 | 48 | #pragma mark - UIViewController Overrides 49 | 50 | - (void)viewDidLoad 51 | { 52 | [super viewDidLoad]; 53 | self.title = NSLocalizedString(@"Examples", nil); 54 | } 55 | 56 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 57 | { 58 | return YES; 59 | } 60 | 61 | 62 | #pragma mark - UITableViewDataSource Protcol Methods 63 | 64 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 65 | { 66 | return 1; 67 | } 68 | 69 | 70 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 71 | { 72 | return 2; 73 | } 74 | 75 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 76 | { 77 | static NSString *cellIdentifier = @"MDCRootViewControllerCellIdentifier"; 78 | 79 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 80 | if (!cell) { 81 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 82 | reuseIdentifier:cellIdentifier]; 83 | } 84 | 85 | switch (indexPath.row) { 86 | case MDCRootViewControllerCellTagUITableView: 87 | cell.textLabel.text = NSLocalizedString(@"UITableView", nil); 88 | break; 89 | case MDCRootViewControllerCellTagEmbeddedUITableView: 90 | cell.textLabel.text = NSLocalizedString(@"Embedded UITableView", nil); 91 | default: 92 | break; 93 | } 94 | 95 | return cell; 96 | } 97 | 98 | 99 | #pragma mark - UITableViewDelegate Protocol Methods 100 | 101 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 102 | { 103 | switch (indexPath.row) { 104 | case MDCRootViewControllerCellTagUITableView: { 105 | MDCTableViewController *tableViewController = [MDCTableViewController new]; 106 | [self.navigationController pushViewController:tableViewController animated:YES]; 107 | break; 108 | } 109 | case MDCRootViewControllerCellTagEmbeddedUITableView: { 110 | MDCEmbeddedTableViewController *embeddedTableViewController = [MDCEmbeddedTableViewController new]; 111 | [self.navigationController pushViewController:embeddedTableViewController animated:YES]; 112 | break; 113 | } 114 | default: 115 | break; 116 | } 117 | } 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/Controllers/MDCTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import 26 | #import "MDCScrollBarViewController.h" 27 | 28 | 29 | @interface MDCTableViewController : MDCScrollBarViewController 30 | 31 | @property (nonatomic, strong) UITableView *tableView; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/Controllers/MDCTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import "MDCTableViewController.h" 26 | 27 | 28 | static CGFloat const kMDCTableViewControllerRowHeight = 100.0f; 29 | 30 | 31 | @interface MDCTableViewController () 32 | 33 | @end 34 | 35 | 36 | @implementation MDCTableViewController 37 | 38 | 39 | #pragma mark - UIViewController Overrides 40 | 41 | - (void)viewDidLoad 42 | { 43 | [super viewDidLoad]; 44 | 45 | self.title = @"UITableView"; 46 | 47 | CGSize size = self.view.frame.size; 48 | self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height) 49 | style:UITableViewStylePlain]; 50 | self.tableView.delegate = self; 51 | self.tableView.dataSource = self; 52 | self.tableView.rowHeight = kMDCTableViewControllerRowHeight; 53 | self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | 54 | UIViewAutoresizingFlexibleHeight; 55 | 56 | self.scrollBarLabel = [[MDCScrollBarLabel alloc] initWithScrollView:self.tableView]; 57 | [self.tableView addSubview:self.scrollBarLabel]; 58 | 59 | [self.view addSubview:self.tableView]; 60 | } 61 | 62 | 63 | - (void)viewDidUnload 64 | { 65 | self.tableView.delegate = nil; 66 | self.tableView.dataSource = nil; 67 | self.tableView = nil; 68 | 69 | [super viewDidUnload]; 70 | } 71 | 72 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 73 | { 74 | return YES; 75 | } 76 | 77 | 78 | #pragma mark - MDCScrollBarViewController Overrides 79 | 80 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 81 | { 82 | [super scrollViewDidScroll:scrollView]; 83 | 84 | NSInteger rowNumber = self.scrollBarLabel.frame.origin.y / kMDCTableViewControllerRowHeight; 85 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:-(60 * 12 * rowNumber)]; 86 | self.scrollBarLabel.date = date; 87 | } 88 | 89 | 90 | #pragma mark - UITableViewDataSource Protocol Methods 91 | 92 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 93 | { 94 | return 1; 95 | } 96 | 97 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 98 | { 99 | return 200; 100 | } 101 | 102 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 103 | { 104 | static NSString *cellIdentifier = @"MDCTableViewControllerCellIdentifier"; 105 | 106 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 107 | if (!cell) { 108 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 109 | reuseIdentifier:cellIdentifier]; 110 | } 111 | 112 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:-(60 * 12 * indexPath.row)]; 113 | cell.textLabel.text = [date description]; 114 | 115 | return cell; 116 | } 117 | 118 | 119 | #pragma mark - UITableViewDelegate Protocol Methods 120 | 121 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 122 | { 123 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 124 | } 125 | 126 | @end 127 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/Delegate/MDCAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import 26 | 27 | 28 | @interface MDCAppDelegate : UIResponder 29 | 30 | @property (strong, nonatomic) UIWindow *window; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/Delegate/MDCAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import "MDCAppDelegate.h" 26 | #import "MDCRootViewController.h" 27 | 28 | 29 | @implementation MDCAppDelegate 30 | 31 | 32 | #pragma mark - UIApplicationDelegate Protocol Methods 33 | 34 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 35 | { 36 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 37 | self.window.backgroundColor = [UIColor whiteColor]; 38 | 39 | MDCRootViewController *rootViewController = [MDCRootViewController new]; 40 | UINavigationController *navController = [[UINavigationController alloc] 41 | initWithRootViewController:rootViewController]; 42 | 43 | self.window.rootViewController = navController; 44 | [self.window makeKeyAndVisible]; 45 | return YES; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/MDCSampleApp-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFiles 12 | 13 | CFBundleIdentifier 14 | com.modocache.ios.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/MDCSampleApp-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MDCSampleApp' target in the 'MDCSampleApp' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleApp/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import 26 | 27 | #import "MDCAppDelegate.h" 28 | 29 | int main(int argc, char *argv[]) 30 | { 31 | @autoreleasepool { 32 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([MDCAppDelegate class])); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleAppTests/MDCSampleAppTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.modocache.ios.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleAppTests/MDCSampleAppTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import 26 | 27 | @interface MDCSampleAppTests : SenTestCase 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleAppTests/MDCSampleAppTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import "MDCSampleAppTests.h" 26 | 27 | @implementation MDCSampleAppTests 28 | 29 | - (void)setUp 30 | { 31 | [super setUp]; 32 | 33 | // Set-up code here. 34 | } 35 | 36 | - (void)tearDown 37 | { 38 | // Tear-down code here. 39 | 40 | [super tearDown]; 41 | } 42 | 43 | - (void)testExample 44 | { 45 | STFail(@"Unit tests are not implemented yet in MDCSampleAppTests"); 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /MDCSampleApp/MDCSampleAppTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /MDCScrollBarLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import 26 | 27 | 28 | @interface MDCScrollBarLabel : UIView 29 | 30 | @property (nonatomic, weak) UIScrollView *scrollView; 31 | @property (nonatomic, strong) NSDate *date; 32 | @property (nonatomic, readonly) BOOL displayed; 33 | @property (nonatomic, assign) NSTimeInterval clockAnimationDuration; 34 | @property (nonatomic, assign) NSTimeInterval fadeAnimationDuration; 35 | @property (nonatomic, assign) CGFloat horizontalPadding; 36 | @property (nonatomic, assign) CGFloat verticalPadding; 37 | 38 | - (id)initWithScrollView:(UIScrollView *)scrollView; 39 | - (void)adjustPositionForScrollView:(UIScrollView *)scrollView; 40 | - (void)setDisplayed:(BOOL)displayed animated:(BOOL)animated afterDelay:(NSTimeInterval)delay; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /MDCScrollBarLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import "MDCScrollBarLabel.h" 26 | #import 27 | 28 | 29 | #undef DEGREES_TO_RADIANS 30 | #define DEGREES_TO_RADIANS(x) M_PI * (x) / 180.0 31 | 32 | 33 | static CGFloat const kMDCScrollBarLabelWidth = 100.0f; 34 | static CGFloat const kMDCScrollBarLabelHeight = 32.0f; 35 | static CGFloat const kMDCScrollBarLabelClockWidth = 24.0f; 36 | static CGFloat const kMDCScrollBarLabelClockTopMargin = -1.0f; 37 | static CGFloat const kMDCScrollBarLabelClockLeftMargin = 4.0f; 38 | static CGFloat const kMDCScrollBarLabelClockRightMargin = 7.0f; 39 | static NSTimeInterval const kMDCScrollBarLabelDefaultClockAnimationDuration = 0.2f; 40 | static NSTimeInterval const kMDCScrollBarLabelDefaultFadeAnimationDuration = 0.3f; 41 | static CGFloat const kMDCScrollBarLabelDefaultHorizontalPadding = 10.0f; 42 | static CGFloat const kMDCScrollBarLabelDefaultVerticalPadding = 30.0f; 43 | 44 | 45 | typedef enum { 46 | MDCClockHandTypeHour = 0, 47 | MDCClockHandTypeMinute 48 | } MDCClockHandType; 49 | 50 | 51 | @interface MDCScrollBarLabel () 52 | @property (nonatomic, strong) NSDate *displayedDate; 53 | @property (nonatomic, strong) UIImageView *clockImageView; 54 | @property (nonatomic, strong) UIImageView *clockCenterImageView; 55 | @property (nonatomic, strong) UIImageView *hourHandImageView; 56 | @property (nonatomic, strong) UIImageView *minuteHandImageView; 57 | @property (nonatomic, strong) UILabel *timeLabel; 58 | @property (nonatomic, strong) UILabel *weekdayLabel; 59 | 60 | @property (nonatomic, strong) NSCalendar *calendar; 61 | @property (nonatomic, strong) NSDateFormatter *dateFormatter; 62 | @property (nonatomic, strong) NSDateFormatter *weekdayDateFormatter; 63 | @end 64 | 65 | 66 | @implementation MDCScrollBarLabel 67 | 68 | 69 | #pragma mark - Object Lifecycle 70 | 71 | - (id)initWithScrollView:(UIScrollView *)scrollView { 72 | CGRect frame = CGRectMake(scrollView.frame.size.width - kMDCScrollBarLabelWidth, 73 | kMDCScrollBarLabelDefaultVerticalPadding, 74 | kMDCScrollBarLabelWidth, 75 | kMDCScrollBarLabelHeight); 76 | 77 | self = [super initWithFrame:frame]; 78 | if (self) { 79 | _clockAnimationDuration = kMDCScrollBarLabelDefaultClockAnimationDuration; 80 | _fadeAnimationDuration = kMDCScrollBarLabelDefaultFadeAnimationDuration; 81 | _horizontalPadding = kMDCScrollBarLabelDefaultHorizontalPadding; 82 | _verticalPadding = kMDCScrollBarLabelDefaultVerticalPadding; 83 | 84 | _scrollView = scrollView; 85 | 86 | _calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 87 | 88 | _dateFormatter = [NSDateFormatter new]; 89 | _dateFormatter.dateFormat = @"h:mm a"; 90 | 91 | _weekdayDateFormatter = [NSDateFormatter new]; 92 | _weekdayDateFormatter.dateFormat = @"EEEE"; 93 | 94 | self.alpha = 0.0f; 95 | self.backgroundColor = [UIColor clearColor]; 96 | 97 | UIImage *backgroundImage = [UIImage imageNamed:@"label-background.png"]; 98 | backgroundImage = [backgroundImage stretchableImageWithLeftCapWidth:15.0f 99 | topCapHeight:5.0f]; 100 | UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:backgroundImage]; 101 | backgroundImageView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); 102 | [self addSubview:backgroundImageView]; 103 | 104 | UIImage *clockFaceImage = [UIImage imageNamed:@"clock-face.png"]; 105 | UIImageView *clockImageView = [[UIImageView alloc] initWithImage:clockFaceImage]; 106 | clockImageView.frame = CGRectMake(kMDCScrollBarLabelClockLeftMargin, 107 | floorf((self.frame.size.height - clockImageView.frame.size.height)/2) 108 | + kMDCScrollBarLabelClockTopMargin, 109 | clockImageView.frame.size.width, 110 | clockImageView.frame.size.height); 111 | [self addSubview:clockImageView]; 112 | 113 | UIImage *clockCenterImage = [UIImage imageNamed:@"clock-center.png"]; 114 | UIImageView *clockCenterImageView = [[UIImageView alloc] initWithImage:clockCenterImage]; 115 | clockCenterImageView.center = clockImageView.center; 116 | [self addSubview:clockCenterImageView]; 117 | 118 | UIImage *hourHandImage = [UIImage imageNamed:@"clock-hour-hand.png"]; 119 | self.hourHandImageView = [[UIImageView alloc] initWithImage:hourHandImage]; 120 | self.hourHandImageView.center = clockCenterImageView.center; 121 | self.hourHandImageView.layer.anchorPoint = CGPointMake(0.5, 1.0); 122 | [self insertSubview:self.hourHandImageView belowSubview:clockCenterImageView]; 123 | 124 | UIImage *minuteHandImage = [UIImage imageNamed:@"clock-minute-hand.png"]; 125 | self.minuteHandImageView = [[UIImageView alloc] initWithImage:minuteHandImage]; 126 | self.minuteHandImageView.center = clockCenterImageView.center; 127 | self.minuteHandImageView.layer.anchorPoint = CGPointMake(0.5, 1.0); 128 | [self insertSubview:self.minuteHandImageView belowSubview:self.hourHandImageView]; 129 | 130 | CGFloat labelHeight = 12.0f; 131 | CGFloat labelWidth = self.frame.size.width - kMDCScrollBarLabelClockWidth - kMDCScrollBarLabelClockRightMargin; 132 | self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, labelWidth, labelHeight)]; 133 | self.timeLabel.textColor = [UIColor whiteColor]; 134 | 135 | CGRect weekdayLabelRect = CGRectMake(kMDCScrollBarLabelClockWidth + kMDCScrollBarLabelClockRightMargin, 136 | floorf(self.frame.size.height/2), 137 | labelWidth, 138 | labelHeight); 139 | self.weekdayLabel = [[UILabel alloc] initWithFrame:weekdayLabelRect]; 140 | self.weekdayLabel.textColor = [UIColor colorWithWhite:0.7 alpha:1.0]; 141 | 142 | for (UILabel *label in @[self.timeLabel, self.weekdayLabel]) { 143 | label.font = [UIFont fontWithName:@"Helvetica-Bold" size:12.0f]; 144 | label.shadowColor = [UIColor darkTextColor]; 145 | label.shadowOffset = CGSizeMake(0, -1); 146 | label.textAlignment = NSTextAlignmentLeft; 147 | label.backgroundColor = [UIColor clearColor]; 148 | } 149 | [self addSubview:self.timeLabel]; 150 | [self insertSubview:self.weekdayLabel belowSubview:self.timeLabel]; 151 | 152 | [self setWeekdayLabelHidden:YES animated:NO]; 153 | } 154 | return self; 155 | } 156 | 157 | 158 | #pragma mark - Public Interface 159 | 160 | - (void)setDate:(NSDate *)date { 161 | unsigned int unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | 162 | NSCalendarUnitWeekday | NSCalendarUnitMinute; 163 | NSDateComponents *dateComponents = [self.calendar components:unitFlags fromDate:date]; 164 | NSDateComponents *nowComponents = [self.calendar components:unitFlags fromDate:[NSDate date]]; 165 | 166 | if (nowComponents.year > dateComponents.year || nowComponents.month > dateComponents.month || nowComponents.day > dateComponents.day) { 167 | NSDate *yesterday = [NSDate dateWithTimeIntervalSinceNow:-(60.0f * 60.0f * 24.0f)]; 168 | 169 | NSDate *beginningOfTheDay = [NSDate date]; 170 | NSCalendar *cal = [NSCalendar currentCalendar]; 171 | NSDateComponents *components = [cal components:( NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitYear | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond ) fromDate:beginningOfTheDay]; 172 | [components setHour:0]; 173 | [components setMinute:0]; 174 | [components setSecond:0]; 175 | beginningOfTheDay = [cal dateFromComponents:components]; 176 | 177 | if ([yesterday compare:date]!=NSOrderedDescending) { 178 | self.weekdayLabel.text = NSLocalizedString(@"Yesterday", nil); 179 | } else { 180 | // or does it correspond to the elapsed week ? 181 | NSDate* elapsedWeek = [beginningOfTheDay dateByAddingTimeInterval:-24*60*60*7]; 182 | if ([elapsedWeek compare:date]!=NSOrderedDescending) { 183 | [self.weekdayDateFormatter setDateFormat:@"EEEE"]; 184 | self.weekdayLabel.text = [self.weekdayDateFormatter stringFromDate:date]; 185 | } else { 186 | [self.weekdayDateFormatter setTimeStyle:NSDateFormatterNoStyle]; 187 | [self.weekdayDateFormatter setDateStyle:NSDateFormatterShortStyle]; 188 | self.weekdayLabel.text = [self.weekdayDateFormatter stringFromDate:date]; 189 | } 190 | } 191 | [self setWeekdayLabelHidden:NO animated:YES]; 192 | } else { 193 | [self setWeekdayLabelHidden:YES animated:YES]; 194 | } 195 | 196 | NSString *dateString = [self.dateFormatter stringFromDate:date]; 197 | self.timeLabel.text = dateString; 198 | 199 | // Grab hour in 12hr format, regardless of user settings. 200 | NSString *hourString = [[dateString componentsSeparatedByString:@":"] objectAtIndex:0]; 201 | NSUInteger hour = [hourString integerValue]; 202 | 203 | BOOL forward = [self.displayedDate compare:date] == NSOrderedAscending; 204 | [self setClockHandWithType:MDCClockHandTypeHour 205 | toValue:hour 206 | inFuture:forward 207 | animated:YES]; 208 | [self setClockHandWithType:MDCClockHandTypeMinute 209 | toValue:dateComponents.minute 210 | inFuture:forward 211 | animated:YES]; 212 | 213 | self.displayedDate = date; 214 | } 215 | 216 | - (void)adjustPositionForScrollView:(UIScrollView *)scrollView { 217 | CGSize size = self.frame.size; 218 | CGPoint origin = self.frame.origin; 219 | UIView *indicator = [[scrollView subviews] lastObject]; 220 | 221 | float y = \ 222 | scrollView.contentOffset.y \ 223 | + scrollView.contentOffset.y * (scrollView.frame.size.height/scrollView.contentSize.height) 224 | + scrollView.frame.size.height/scrollView.contentSize.height \ 225 | + (indicator.frame.size.height - size.height)/2; 226 | 227 | float topLimit = self.verticalPadding + scrollView.contentOffset.y; 228 | 229 | if (y < topLimit || isnan(y)) { 230 | y = topLimit; 231 | } 232 | 233 | self.frame = CGRectMake(origin.x, y, size.width, size.height); 234 | } 235 | 236 | - (void)setDisplayed:(BOOL)displayed animated:(BOOL)animated afterDelay:(NSTimeInterval)delay { 237 | CGFloat end = displayed ? -self.horizontalPadding : 0.0; 238 | 239 | BOOL animationsEnabled = [UIView areAnimationsEnabled]; 240 | [UIView setAnimationsEnabled:animated]; 241 | [UIView animateWithDuration:self.fadeAnimationDuration 242 | delay:delay 243 | options:UIViewAnimationOptionBeginFromCurrentState 244 | animations:^{ 245 | self.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, end, 0.0); 246 | self.alpha = displayed ? 1.0f : 0.0f; 247 | } completion:^(BOOL finished) { 248 | if (finished) { 249 | self.center = CGPointMake(floorf(self.scrollView.frame.size.width - self.frame.size.width/2), 250 | self.center.y); 251 | _displayed = YES; 252 | } 253 | }]; 254 | [UIView setAnimationsEnabled:animationsEnabled]; 255 | } 256 | 257 | 258 | #pragma mark - Internal Methods 259 | 260 | - (void)setClockHandWithType:(MDCClockHandType)type toValue:(NSUInteger)value inFuture:(BOOL)inFuture animated:(BOOL)animated { 261 | if (type == MDCClockHandTypeHour && value > 12) { 262 | return; 263 | } 264 | 265 | if (type == MDCClockHandTypeMinute && value > 60) { 266 | return; 267 | } 268 | 269 | CGFloat angleForValue = type == MDCClockHandTypeHour ? 30.0 : 6.0f; 270 | __block UIImageView *handImageView = 271 | type == MDCClockHandTypeHour ? self.hourHandImageView : self.minuteHandImageView; 272 | 273 | CGFloat end = value * DEGREES_TO_RADIANS(angleForValue); 274 | end = inFuture ? end : -end; 275 | 276 | BOOL animationsEnabled = [UIView areAnimationsEnabled]; 277 | [UIView setAnimationsEnabled:animated]; 278 | [UIView animateWithDuration:self.clockAnimationDuration 279 | delay:0.0f 280 | options:UIViewAnimationOptionBeginFromCurrentState 281 | animations:^{ 282 | handImageView.transform = CGAffineTransformMakeRotation(end); 283 | } 284 | completion:nil]; 285 | [UIView setAnimationsEnabled:animationsEnabled]; 286 | } 287 | 288 | - (void)setWeekdayLabelHidden:(BOOL)hidden animated:(BOOL)animated { 289 | CGFloat labelOriginX = kMDCScrollBarLabelClockWidth + kMDCScrollBarLabelClockRightMargin; 290 | CGFloat labelOriginY = floorf((self.frame.size.height - self.timeLabel.frame.size.height)/2); 291 | labelOriginY = hidden ? labelOriginY : floorf(labelOriginY - (labelOriginY/2) - 1); 292 | CGRect labelRect = CGRectMake(labelOriginX, 293 | labelOriginY, 294 | self.timeLabel.frame.size.width, 295 | self.timeLabel.frame.size.height); 296 | 297 | BOOL animationsEnabled = [UIView areAnimationsEnabled]; 298 | [UIView setAnimationsEnabled:animated]; 299 | [UIView animateWithDuration:self.clockAnimationDuration animations:^{ 300 | self.timeLabel.frame = labelRect; 301 | self.weekdayLabel.alpha = hidden ? 0 : 1.0f; 302 | }]; 303 | [UIView setAnimationsEnabled:animationsEnabled]; 304 | } 305 | 306 | @end 307 | -------------------------------------------------------------------------------- /MDCScrollBarLabel.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'MDCScrollBarLabel' 3 | s.version = '0.1.3' 4 | s.summary = 'Like Path\'s timestamp scrollbar label.' 5 | s.homepage = 'https://github.com/modocache/MDCScrollBarLabel' 6 | s.license = 'MIT' 7 | s.author = { 'modocache' => 'modocache@gmail.com' } 8 | s.social_media_url = 'https://twitter.com/modocache' 9 | s.source = { :git => 'https://github.com/modocache/MDCScrollBarLabel.git', :tag => "v#{s.version}" } 10 | s.source_files = '*.{h,m}' 11 | s.resources = 'Resources/Images/*.png' 12 | s.requires_arc = true 13 | s.platform = :ios, '5.0' 14 | s.framework = 'UIKit' 15 | end 16 | -------------------------------------------------------------------------------- /MDCScrollBarLabel.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MDCScrollBarViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import 26 | #import "MDCScrollBarLabel.h" 27 | 28 | 29 | @interface MDCScrollBarViewController : UIViewController 30 | 31 | @property (nonatomic, strong) MDCScrollBarLabel *scrollBarLabel; 32 | @property (nonatomic, assign) NSTimeInterval scrollBarFadeDelay; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MDCScrollBarViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 modocache 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining 5 | // a copy of this software and associated documentation files (the 6 | // "Software"), to deal in the Software without restriction, including 7 | // without limitation the rights to use, copy, modify, merge, publish, 8 | // distribute, sublicense, and/or sell copies of the Software, and to 9 | // permit persons to whom the Software is furnished to do so, subject to 10 | // the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | 25 | #import "MDCScrollBarViewController.h" 26 | 27 | 28 | static CGFloat const kMDCScrollBarViewControllerDefaultFadeDelay = 1.0f; 29 | 30 | 31 | @implementation MDCScrollBarViewController 32 | 33 | 34 | #pragma mark - Object Lifecycle 35 | 36 | - (id)init 37 | { 38 | self = [super init]; 39 | if (self) { 40 | _scrollBarFadeDelay = kMDCScrollBarViewControllerDefaultFadeDelay; 41 | } 42 | return self; 43 | } 44 | 45 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 46 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 47 | if (self) { 48 | _scrollBarFadeDelay = kMDCScrollBarViewControllerDefaultFadeDelay; 49 | } 50 | return self; 51 | } 52 | 53 | - (id)initWithCoder:(NSCoder *)aDecoder { 54 | self = [super initWithCoder:aDecoder]; 55 | if (self) { 56 | _scrollBarFadeDelay = kMDCScrollBarViewControllerDefaultFadeDelay; 57 | } 58 | return self; 59 | } 60 | 61 | 62 | #pragma mark - UIViewController Overrides 63 | 64 | - (void)viewDidUnload 65 | { 66 | self.scrollBarLabel.scrollView = nil; 67 | self.scrollBarLabel = nil; 68 | 69 | [super viewDidUnload]; 70 | } 71 | 72 | 73 | #pragma mark - UIScrollViewDelegate Protocol Methods 74 | 75 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 76 | [self.scrollBarLabel adjustPositionForScrollView:scrollView]; 77 | [self.scrollBarLabel setDisplayed:YES animated:YES afterDelay:0.0f]; 78 | } 79 | 80 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { 81 | [self.scrollBarLabel setDisplayed:NO animated:YES afterDelay:self.scrollBarFadeDelay]; 82 | } 83 | 84 | - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { 85 | if (!decelerate) { 86 | [self.scrollBarLabel setDisplayed:NO animated:YES afterDelay:self.scrollBarFadeDelay]; 87 | } 88 | } 89 | 90 | - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView { 91 | [self.scrollBarLabel setDisplayed:NO animated:YES afterDelay:self.scrollBarFadeDelay]; 92 | } 93 | 94 | - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView { 95 | [self.scrollBarLabel setDisplayed:NO animated:YES afterDelay:self.scrollBarFadeDelay]; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MDCScrollBarLabel 2 | 3 | An animated scroll bar to present extra information when scrolling on a UIScrollView. 4 | 5 | Y'know, like the clock on Path. 6 | 7 | ![MDCScrollBarLabel GIF](http://f.cl.ly/items/2U3d0j3G3O2j1W1Q3525/mdcscrollbarlabel.gif) 8 | 9 | ## Usage 10 | 11 | Basically, you have two options. You can: 12 | 13 | - Subclass MDCScrollBarViewController and set an MDCScrollBarLabel to its 14 | scrollBarLabel property. 15 | - Implement a UIViewController which is a UIScrollBarDelegate, then call the 16 | fade in/out logic for the label as you'd like. 17 | 18 | See the example application for usage. 19 | 20 | ### Subclassing `MDCScrollBarViewController` 21 | 22 | ```objc 23 | #pragma mark - Creating the Scroll Bar Label 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | 28 | // Create a table view with a row height of 100.f 29 | CGSize size = self.view.frame.size; 30 | self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds 31 | style:UITableViewStylePlain]; 32 | self.tableView.delegate = self; 33 | self.tableView.dataSource = self; 34 | self.tableView.rowHeight = 100.f; 35 | [self.view addSubview:self.tableView]; 36 | 37 | // Add a scroll bar label to the table view 38 | self.scrollBarLabel = [[MDCScrollBarLabel alloc] initWithScrollView:self.tableView]; 39 | [self.tableView addSubview:self.scrollBarLabel]; 40 | } 41 | 42 | #pragma mark - Updating the Date on the Scroll Bar Label 43 | 44 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 45 | [super scrollViewDidScroll:scrollView]; 46 | 47 | // Determine which row the scroll bar label is currently hovering over 48 | NSInteger rowNumber = CGRectGetMinY(self.scrollBarLabel.frame) / 100.f; 49 | 50 | // Update the date on the label using the model data for that row 51 | // (here we assume you have a model named `Event`) 52 | Event *event = self.events[rowNumber]; 53 | self.scrollBarLabel.date = event.date; 54 | } 55 | ``` 56 | 57 | ### Subclassing `UIViewController ` 58 | 59 | ```objc 60 | #pragma mark - Show/Hide the Label Using UIScrollViewDelegate Callbacks 61 | 62 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 63 | [self.scrollBarLabel adjustPositionForScrollView:scrollView]; 64 | [self.scrollBarLabel setDisplayed:YES animated:YES afterDelay:0.0f]; 65 | } 66 | 67 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { 68 | [self.scrollBarLabel setDisplayed:NO animated:YES afterDelay:self.scrollBarFadeDelay]; 69 | } 70 | 71 | - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView 72 | willDecelerate:(BOOL)decelerate { 73 | if (!decelerate) { 74 | [self.scrollBarLabel setDisplayed:NO animated:YES afterDelay:self.scrollBarFadeDelay]; 75 | } 76 | } 77 | 78 | - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView { 79 | [self.scrollBarLabel setDisplayed:NO animated:YES afterDelay:self.scrollBarFadeDelay]; 80 | } 81 | 82 | - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView { 83 | [self.scrollBarLabel setDisplayed:NO animated:YES afterDelay:self.scrollBarFadeDelay]; 84 | } 85 | ``` 86 | 87 | ## License 88 | 89 | MIT license. See the LICENSE file for details. 90 | 91 | -------------------------------------------------------------------------------- /Resources/Images/clock-center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modocache/MDCScrollBarLabel/124677a82327752688553ca960ebb65ecaa16d33/Resources/Images/clock-center.png -------------------------------------------------------------------------------- /Resources/Images/clock-center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modocache/MDCScrollBarLabel/124677a82327752688553ca960ebb65ecaa16d33/Resources/Images/clock-center@2x.png -------------------------------------------------------------------------------- /Resources/Images/clock-face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modocache/MDCScrollBarLabel/124677a82327752688553ca960ebb65ecaa16d33/Resources/Images/clock-face.png -------------------------------------------------------------------------------- /Resources/Images/clock-face@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modocache/MDCScrollBarLabel/124677a82327752688553ca960ebb65ecaa16d33/Resources/Images/clock-face@2x.png -------------------------------------------------------------------------------- /Resources/Images/clock-hour-hand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modocache/MDCScrollBarLabel/124677a82327752688553ca960ebb65ecaa16d33/Resources/Images/clock-hour-hand.png -------------------------------------------------------------------------------- /Resources/Images/clock-hour-hand@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modocache/MDCScrollBarLabel/124677a82327752688553ca960ebb65ecaa16d33/Resources/Images/clock-hour-hand@2x.png -------------------------------------------------------------------------------- /Resources/Images/clock-minute-hand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modocache/MDCScrollBarLabel/124677a82327752688553ca960ebb65ecaa16d33/Resources/Images/clock-minute-hand.png -------------------------------------------------------------------------------- /Resources/Images/clock-minute-hand@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modocache/MDCScrollBarLabel/124677a82327752688553ca960ebb65ecaa16d33/Resources/Images/clock-minute-hand@2x.png -------------------------------------------------------------------------------- /Resources/Images/label-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modocache/MDCScrollBarLabel/124677a82327752688553ca960ebb65ecaa16d33/Resources/Images/label-background.png -------------------------------------------------------------------------------- /Resources/Images/label-background@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modocache/MDCScrollBarLabel/124677a82327752688553ca960ebb65ecaa16d33/Resources/Images/label-background@2x.png --------------------------------------------------------------------------------