├── .gitignore
├── Examples
├── FeatureDemo
│ ├── FeatureDemo.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── FeatureDemo
│ │ ├── FeatureDemo.xcodeproj
│ │ └── project.pbxproj
│ │ └── FeatureDemo
│ │ ├── FeatureDemo-Info.plist
│ │ ├── FeatureDemo-Prefix.pch
│ │ ├── FeatureDemo.entitlements
│ │ ├── KKAppDelegate.h
│ │ ├── KKAppDelegate.m
│ │ ├── KKDemoCell.h
│ │ ├── KKDemoCell.m
│ │ ├── KKDetailViewController.h
│ │ ├── KKDetailViewController.m
│ │ ├── KKMasterViewController.h
│ │ ├── KKMasterViewController.m
│ │ ├── en.lproj
│ │ ├── InfoPlist.strings
│ │ ├── KKDetailViewController.xib
│ │ └── KKMasterViewController.xib
│ │ └── main.m
└── GridViewDemo
│ ├── Default-Landscape@2x.png
│ ├── Default@2x.png
│ ├── GridViewDemo.xcodeproj
│ └── project.pbxproj
│ ├── GridViewDemo.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── GridViewDemo.xcscheme
│ │ └── KKGridView.xcscheme
│ └── GridViewDemo
│ ├── GridViewDemo-Info.plist
│ ├── GridViewDemo-Prefix.pch
│ ├── GridViewDemo.entitlements
│ ├── GridViewDemoAppDelegate.h
│ ├── GridViewDemoAppDelegate.m
│ ├── GridViewDemoViewController.h
│ ├── GridViewDemoViewController.m
│ ├── Resources
│ ├── Default.png
│ ├── KKGridViewIcon.png
│ └── KKGridViewIcon@2x.png
│ ├── en.lproj
│ ├── GridViewDemoViewController.xib
│ ├── InfoPlist.strings
│ └── MainWindow.xib
│ └── main.m
├── KKGridView.podspec
├── KKGridView.xcodeproj
├── project.pbxproj
└── project.xcworkspace
│ └── contents.xcworkspacedata
├── KKGridView
├── Definitions.h
├── KKBlocksDelegate.h
├── KKBlocksDelegate.m
├── KKGridView-Prefix.pch
├── KKGridView.bundle
│ ├── UISectionListHeaderBackground.png
│ ├── UISectionListHeaderBackground@2x.png
│ ├── UISectionListHeaderBackgroundOpaque.png
│ ├── UISectionListHeaderBackgroundOpaque@2x.png
│ ├── UIUnreadIndicator.png
│ ├── UIUnreadIndicator@2x.png
│ ├── UIUnreadIndicatorPartial.png
│ ├── UIUnreadIndicatorPartial@2x.png
│ ├── UIUnreadIndicatorPartialPressed.png
│ ├── UIUnreadIndicatorPartialPressed@2x.png
│ ├── UIUnreadIndicatorPressed.png
│ ├── UIUnreadIndicatorPressed@2x.png
│ ├── failure-btn-press.png
│ ├── failure-btn-press@2x.png
│ ├── failure-btn.png
│ └── failure-btn@2x.png
├── KKGridView.h
├── KKGridView.m
├── KKGridViewCell.h
├── KKGridViewCell.m
├── KKGridViewController.h
├── KKGridViewController.m
├── KKGridViewIndexView.h
├── KKGridViewIndexView.m
├── KKGridViewSectionInfo.h
├── KKGridViewSectionInfo.m
├── KKGridViewSectionLabel.h
├── KKGridViewSectionLabel.m
├── KKGridViewUpdate.h
├── KKGridViewUpdate.m
├── KKGridViewUpdateStack.h
├── KKGridViewUpdateStack.m
├── KKIndexPath.h
└── KKIndexPath.m
├── LICENSE
├── README.md
└── Resources
├── Resources-Info.plist
├── Resources-Prefix.pch
└── en.lproj
└── InfoPlist.strings
/.gitignore:
--------------------------------------------------------------------------------
1 | *.xcodeproj/*.pbxuser
2 | *.xcodeproj/*.perspectivev3
3 | *.xcodeproj/xcuserdata/
4 | *.xcodeproj/project.xcworkspace/xcuserdata/
5 | *.xcuserstate
6 | Examples/*/*.xcodeproj/xcuserdata
7 | build/
8 | .DS_Store
9 | Examples/GridViewDemo/GridViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
10 | *.xcuserdatad
11 | Examples/FeatureDemo/FeatureDemo/FeatureDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 33B3258F154C98DA00CB9597 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33B3258E154C98DA00CB9597 /* UIKit.framework */; };
11 | 33B32591154C98DA00CB9597 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33B32590154C98DA00CB9597 /* Foundation.framework */; };
12 | 33B32593154C98DA00CB9597 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33B32592154C98DA00CB9597 /* CoreGraphics.framework */; };
13 | 33B32599154C98DA00CB9597 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 33B32597154C98DA00CB9597 /* InfoPlist.strings */; };
14 | 33B3259B154C98DA00CB9597 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 33B3259A154C98DA00CB9597 /* main.m */; };
15 | 33B3259F154C98DA00CB9597 /* KKAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 33B3259E154C98DA00CB9597 /* KKAppDelegate.m */; };
16 | 33B325A1154C98DA00CB9597 /* FeatureDemo.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 33B325A0154C98DA00CB9597 /* FeatureDemo.entitlements */; };
17 | 33B325A4154C98DA00CB9597 /* KKMasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 33B325A3154C98DA00CB9597 /* KKMasterViewController.m */; };
18 | 33B325A7154C98DA00CB9597 /* KKDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 33B325A6154C98DA00CB9597 /* KKDetailViewController.m */; };
19 | 33B325AA154C98DA00CB9597 /* KKMasterViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33B325A8154C98DA00CB9597 /* KKMasterViewController.xib */; };
20 | 33B325AD154C98DA00CB9597 /* KKDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33B325AB154C98DA00CB9597 /* KKDetailViewController.xib */; };
21 | 33B325B4154CA66300CB9597 /* libKKGridView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 33B325B3154CA66300CB9597 /* libKKGridView.a */; };
22 | 33B325BB154CB0C200CB9597 /* KKDemoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 33B325BA154CB0C200CB9597 /* KKDemoCell.m */; };
23 | 33B325BD154E540700CB9597 /* KKGridView.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 33B325BC154E540700CB9597 /* KKGridView.bundle */; };
24 | /* End PBXBuildFile section */
25 |
26 | /* Begin PBXFileReference section */
27 | 33B3258A154C98DA00CB9597 /* FeatureDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FeatureDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
28 | 33B3258E154C98DA00CB9597 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
29 | 33B32590154C98DA00CB9597 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
30 | 33B32592154C98DA00CB9597 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
31 | 33B32596154C98DA00CB9597 /* FeatureDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FeatureDemo-Info.plist"; sourceTree = ""; };
32 | 33B32598154C98DA00CB9597 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
33 | 33B3259A154C98DA00CB9597 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
34 | 33B3259C154C98DA00CB9597 /* FeatureDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FeatureDemo-Prefix.pch"; sourceTree = ""; };
35 | 33B3259D154C98DA00CB9597 /* KKAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KKAppDelegate.h; sourceTree = ""; };
36 | 33B3259E154C98DA00CB9597 /* KKAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KKAppDelegate.m; sourceTree = ""; };
37 | 33B325A0154C98DA00CB9597 /* FeatureDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = FeatureDemo.entitlements; sourceTree = ""; };
38 | 33B325A2154C98DA00CB9597 /* KKMasterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KKMasterViewController.h; sourceTree = ""; };
39 | 33B325A3154C98DA00CB9597 /* KKMasterViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KKMasterViewController.m; sourceTree = ""; };
40 | 33B325A5154C98DA00CB9597 /* KKDetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KKDetailViewController.h; sourceTree = ""; };
41 | 33B325A6154C98DA00CB9597 /* KKDetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KKDetailViewController.m; sourceTree = ""; };
42 | 33B325A9154C98DA00CB9597 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/KKMasterViewController.xib; sourceTree = ""; };
43 | 33B325AC154C98DA00CB9597 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/KKDetailViewController.xib; sourceTree = ""; };
44 | 33B325B3154CA66300CB9597 /* libKKGridView.a */ = {isa = PBXFileReference; lastKnownFileType = file; name = libKKGridView.a; path = "../../../build/Release-iphoneos/libKKGridView.a"; sourceTree = ""; };
45 | 33B325B9154CB0C200CB9597 /* KKDemoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKDemoCell.h; sourceTree = ""; };
46 | 33B325BA154CB0C200CB9597 /* KKDemoCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KKDemoCell.m; sourceTree = ""; };
47 | 33B325BC154E540700CB9597 /* KKGridView.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = KKGridView.bundle; path = ../../../../KKGridView/KKGridView.bundle; sourceTree = ""; };
48 | /* End PBXFileReference section */
49 |
50 | /* Begin PBXFrameworksBuildPhase section */
51 | 33B32587154C98DA00CB9597 /* Frameworks */ = {
52 | isa = PBXFrameworksBuildPhase;
53 | buildActionMask = 2147483647;
54 | files = (
55 | 33B3258F154C98DA00CB9597 /* UIKit.framework in Frameworks */,
56 | 33B32591154C98DA00CB9597 /* Foundation.framework in Frameworks */,
57 | 33B32593154C98DA00CB9597 /* CoreGraphics.framework in Frameworks */,
58 | 33B325B4154CA66300CB9597 /* libKKGridView.a in Frameworks */,
59 | );
60 | runOnlyForDeploymentPostprocessing = 0;
61 | };
62 | /* End PBXFrameworksBuildPhase section */
63 |
64 | /* Begin PBXGroup section */
65 | 33B3257F154C98DA00CB9597 = {
66 | isa = PBXGroup;
67 | children = (
68 | 33B32594154C98DA00CB9597 /* FeatureDemo */,
69 | 33B3258D154C98DA00CB9597 /* Frameworks */,
70 | 33B3258B154C98DA00CB9597 /* Products */,
71 | );
72 | sourceTree = "";
73 | };
74 | 33B3258B154C98DA00CB9597 /* Products */ = {
75 | isa = PBXGroup;
76 | children = (
77 | 33B3258A154C98DA00CB9597 /* FeatureDemo.app */,
78 | );
79 | name = Products;
80 | sourceTree = "";
81 | };
82 | 33B3258D154C98DA00CB9597 /* Frameworks */ = {
83 | isa = PBXGroup;
84 | children = (
85 | 33B325B3154CA66300CB9597 /* libKKGridView.a */,
86 | 33B3258E154C98DA00CB9597 /* UIKit.framework */,
87 | 33B32590154C98DA00CB9597 /* Foundation.framework */,
88 | 33B32592154C98DA00CB9597 /* CoreGraphics.framework */,
89 | );
90 | name = Frameworks;
91 | sourceTree = "";
92 | };
93 | 33B32594154C98DA00CB9597 /* FeatureDemo */ = {
94 | isa = PBXGroup;
95 | children = (
96 | 33B3259D154C98DA00CB9597 /* KKAppDelegate.h */,
97 | 33B3259E154C98DA00CB9597 /* KKAppDelegate.m */,
98 | 33B325A2154C98DA00CB9597 /* KKMasterViewController.h */,
99 | 33B325A3154C98DA00CB9597 /* KKMasterViewController.m */,
100 | 33B325A5154C98DA00CB9597 /* KKDetailViewController.h */,
101 | 33B325A6154C98DA00CB9597 /* KKDetailViewController.m */,
102 | 33B325B9154CB0C200CB9597 /* KKDemoCell.h */,
103 | 33B325BA154CB0C200CB9597 /* KKDemoCell.m */,
104 | 33B325A8154C98DA00CB9597 /* KKMasterViewController.xib */,
105 | 33B325AB154C98DA00CB9597 /* KKDetailViewController.xib */,
106 | 33B325BC154E540700CB9597 /* KKGridView.bundle */,
107 | 33B32595154C98DA00CB9597 /* Supporting Files */,
108 | );
109 | path = FeatureDemo;
110 | sourceTree = "";
111 | };
112 | 33B32595154C98DA00CB9597 /* Supporting Files */ = {
113 | isa = PBXGroup;
114 | children = (
115 | 33B32596154C98DA00CB9597 /* FeatureDemo-Info.plist */,
116 | 33B32597154C98DA00CB9597 /* InfoPlist.strings */,
117 | 33B3259A154C98DA00CB9597 /* main.m */,
118 | 33B3259C154C98DA00CB9597 /* FeatureDemo-Prefix.pch */,
119 | 33B325A0154C98DA00CB9597 /* FeatureDemo.entitlements */,
120 | );
121 | name = "Supporting Files";
122 | sourceTree = "";
123 | };
124 | /* End PBXGroup section */
125 |
126 | /* Begin PBXNativeTarget section */
127 | 33B32589154C98DA00CB9597 /* FeatureDemo */ = {
128 | isa = PBXNativeTarget;
129 | buildConfigurationList = 33B325B0154C98DA00CB9597 /* Build configuration list for PBXNativeTarget "FeatureDemo" */;
130 | buildPhases = (
131 | 33B32586154C98DA00CB9597 /* Sources */,
132 | 33B32587154C98DA00CB9597 /* Frameworks */,
133 | 33B32588154C98DA00CB9597 /* Resources */,
134 | );
135 | buildRules = (
136 | );
137 | dependencies = (
138 | );
139 | name = FeatureDemo;
140 | productName = FeatureDemo;
141 | productReference = 33B3258A154C98DA00CB9597 /* FeatureDemo.app */;
142 | productType = "com.apple.product-type.application";
143 | };
144 | /* End PBXNativeTarget section */
145 |
146 | /* Begin PBXProject section */
147 | 33B32581154C98DA00CB9597 /* Project object */ = {
148 | isa = PBXProject;
149 | attributes = {
150 | CLASSPREFIX = KK;
151 | LastUpgradeCheck = 0440;
152 | ORGANIZATIONNAME = "Kolin Krewinkel";
153 | };
154 | buildConfigurationList = 33B32584154C98DA00CB9597 /* Build configuration list for PBXProject "FeatureDemo" */;
155 | compatibilityVersion = "Xcode 3.2";
156 | developmentRegion = English;
157 | hasScannedForEncodings = 0;
158 | knownRegions = (
159 | en,
160 | );
161 | mainGroup = 33B3257F154C98DA00CB9597;
162 | productRefGroup = 33B3258B154C98DA00CB9597 /* Products */;
163 | projectDirPath = "";
164 | projectRoot = "";
165 | targets = (
166 | 33B32589154C98DA00CB9597 /* FeatureDemo */,
167 | );
168 | };
169 | /* End PBXProject section */
170 |
171 | /* Begin PBXResourcesBuildPhase section */
172 | 33B32588154C98DA00CB9597 /* Resources */ = {
173 | isa = PBXResourcesBuildPhase;
174 | buildActionMask = 2147483647;
175 | files = (
176 | 33B32599154C98DA00CB9597 /* InfoPlist.strings in Resources */,
177 | 33B325A1154C98DA00CB9597 /* FeatureDemo.entitlements in Resources */,
178 | 33B325AA154C98DA00CB9597 /* KKMasterViewController.xib in Resources */,
179 | 33B325AD154C98DA00CB9597 /* KKDetailViewController.xib in Resources */,
180 | 33B325BD154E540700CB9597 /* KKGridView.bundle in Resources */,
181 | );
182 | runOnlyForDeploymentPostprocessing = 0;
183 | };
184 | /* End PBXResourcesBuildPhase section */
185 |
186 | /* Begin PBXSourcesBuildPhase section */
187 | 33B32586154C98DA00CB9597 /* Sources */ = {
188 | isa = PBXSourcesBuildPhase;
189 | buildActionMask = 2147483647;
190 | files = (
191 | 33B3259B154C98DA00CB9597 /* main.m in Sources */,
192 | 33B3259F154C98DA00CB9597 /* KKAppDelegate.m in Sources */,
193 | 33B325A4154C98DA00CB9597 /* KKMasterViewController.m in Sources */,
194 | 33B325A7154C98DA00CB9597 /* KKDetailViewController.m in Sources */,
195 | 33B325BB154CB0C200CB9597 /* KKDemoCell.m in Sources */,
196 | );
197 | runOnlyForDeploymentPostprocessing = 0;
198 | };
199 | /* End PBXSourcesBuildPhase section */
200 |
201 | /* Begin PBXVariantGroup section */
202 | 33B32597154C98DA00CB9597 /* InfoPlist.strings */ = {
203 | isa = PBXVariantGroup;
204 | children = (
205 | 33B32598154C98DA00CB9597 /* en */,
206 | );
207 | name = InfoPlist.strings;
208 | sourceTree = "";
209 | };
210 | 33B325A8154C98DA00CB9597 /* KKMasterViewController.xib */ = {
211 | isa = PBXVariantGroup;
212 | children = (
213 | 33B325A9154C98DA00CB9597 /* en */,
214 | );
215 | name = KKMasterViewController.xib;
216 | sourceTree = "";
217 | };
218 | 33B325AB154C98DA00CB9597 /* KKDetailViewController.xib */ = {
219 | isa = PBXVariantGroup;
220 | children = (
221 | 33B325AC154C98DA00CB9597 /* en */,
222 | );
223 | name = KKDetailViewController.xib;
224 | sourceTree = "";
225 | };
226 | /* End PBXVariantGroup section */
227 |
228 | /* Begin XCBuildConfiguration section */
229 | 33B325AE154C98DA00CB9597 /* Debug */ = {
230 | isa = XCBuildConfiguration;
231 | buildSettings = {
232 | ALWAYS_SEARCH_USER_PATHS = NO;
233 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
234 | CLANG_ENABLE_OBJC_ARC = YES;
235 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
236 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
237 | COPY_PHASE_STRIP = NO;
238 | GCC_C_LANGUAGE_STANDARD = gnu99;
239 | GCC_DYNAMIC_NO_PIC = NO;
240 | GCC_OPTIMIZATION_LEVEL = 0;
241 | GCC_PREPROCESSOR_DEFINITIONS = (
242 | "DEBUG=1",
243 | "$(inherited)",
244 | );
245 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
246 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
247 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
248 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
249 | GCC_WARN_UNUSED_VARIABLE = YES;
250 | IPHONEOS_DEPLOYMENT_TARGET = 5.1;
251 | SDKROOT = iphoneos;
252 | TARGETED_DEVICE_FAMILY = 2;
253 | };
254 | name = Debug;
255 | };
256 | 33B325AF154C98DA00CB9597 /* Release */ = {
257 | isa = XCBuildConfiguration;
258 | buildSettings = {
259 | ALWAYS_SEARCH_USER_PATHS = NO;
260 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
261 | CLANG_ENABLE_OBJC_ARC = YES;
262 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
263 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
264 | COPY_PHASE_STRIP = YES;
265 | GCC_C_LANGUAGE_STANDARD = gnu99;
266 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
267 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
268 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
269 | GCC_WARN_UNUSED_VARIABLE = YES;
270 | IPHONEOS_DEPLOYMENT_TARGET = 5.1;
271 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
272 | SDKROOT = iphoneos;
273 | TARGETED_DEVICE_FAMILY = 2;
274 | VALIDATE_PRODUCT = YES;
275 | };
276 | name = Release;
277 | };
278 | 33B325B1154C98DA00CB9597 /* Debug */ = {
279 | isa = XCBuildConfiguration;
280 | buildSettings = {
281 | CODE_SIGN_ENTITLEMENTS = FeatureDemo/FeatureDemo.entitlements;
282 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
283 | GCC_PREFIX_HEADER = "FeatureDemo/FeatureDemo-Prefix.pch";
284 | INFOPLIST_FILE = "FeatureDemo/FeatureDemo-Info.plist";
285 | IPHONEOS_DEPLOYMENT_TARGET = 5.0;
286 | PRODUCT_NAME = "$(TARGET_NAME)";
287 | WRAPPER_EXTENSION = app;
288 | };
289 | name = Debug;
290 | };
291 | 33B325B2154C98DA00CB9597 /* Release */ = {
292 | isa = XCBuildConfiguration;
293 | buildSettings = {
294 | CODE_SIGN_ENTITLEMENTS = FeatureDemo/FeatureDemo.entitlements;
295 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
296 | GCC_PREFIX_HEADER = "FeatureDemo/FeatureDemo-Prefix.pch";
297 | INFOPLIST_FILE = "FeatureDemo/FeatureDemo-Info.plist";
298 | IPHONEOS_DEPLOYMENT_TARGET = 5.0;
299 | PRODUCT_NAME = "$(TARGET_NAME)";
300 | WRAPPER_EXTENSION = app;
301 | };
302 | name = Release;
303 | };
304 | /* End XCBuildConfiguration section */
305 |
306 | /* Begin XCConfigurationList section */
307 | 33B32584154C98DA00CB9597 /* Build configuration list for PBXProject "FeatureDemo" */ = {
308 | isa = XCConfigurationList;
309 | buildConfigurations = (
310 | 33B325AE154C98DA00CB9597 /* Debug */,
311 | 33B325AF154C98DA00CB9597 /* Release */,
312 | );
313 | defaultConfigurationIsVisible = 0;
314 | defaultConfigurationName = Release;
315 | };
316 | 33B325B0154C98DA00CB9597 /* Build configuration list for PBXNativeTarget "FeatureDemo" */ = {
317 | isa = XCConfigurationList;
318 | buildConfigurations = (
319 | 33B325B1154C98DA00CB9597 /* Debug */,
320 | 33B325B2154C98DA00CB9597 /* Release */,
321 | );
322 | defaultConfigurationIsVisible = 0;
323 | };
324 | /* End XCConfigurationList section */
325 | };
326 | rootObject = 33B32581154C98DA00CB9597 /* Project object */;
327 | }
328 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/FeatureDemo-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | com.kkgridview.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/FeatureDemo-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'FeatureDemo' target in the 'FeatureDemo' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_4_0
8 | #warning "This project uses features only available in iOS SDK 4.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #import
15 | #endif
16 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/FeatureDemo.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | DataProtectionClass
6 | NSFileProtectionComplete
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/KKAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKAppDelegate.h
3 | // FeatureDemo
4 | //
5 | // Created by Kolin Krewinkel on 4/28/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface KKAppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @property (strong, nonatomic) UISplitViewController *splitViewController;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/KKAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKAppDelegate.m
3 | // FeatureDemo
4 | //
5 | // Created by Kolin Krewinkel on 4/28/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import "KKAppDelegate.h"
10 |
11 | #import "KKMasterViewController.h"
12 |
13 | #import "KKDetailViewController.h"
14 |
15 | @implementation KKAppDelegate
16 |
17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
18 | {
19 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
20 | // Override point for customization after application launch.
21 |
22 | KKMasterViewController *masterViewController = [[KKMasterViewController alloc] initWithNibName:@"KKMasterViewController" bundle:nil];
23 | UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
24 |
25 | KKDetailViewController *detailViewController = [[KKDetailViewController alloc] initWithNibName:@"KKDetailViewController" bundle:nil];
26 | UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
27 |
28 | masterViewController.detailViewController = detailViewController;
29 |
30 | self.splitViewController = [[UISplitViewController alloc] init];
31 | self.splitViewController.delegate = detailViewController;
32 | self.splitViewController.viewControllers = @[masterNavigationController, detailNavigationController];
33 | self.window.rootViewController = self.splitViewController;
34 | [self.window makeKeyAndVisible];
35 | return YES;
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/KKDemoCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKDemoCell.h
3 | // FeatureDemo
4 | //
5 | // Created by Kolin Krewinkel on 4/28/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface KKDemoCell : KKGridViewCell
12 |
13 | @property (nonatomic, strong) UILabel *label;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/KKDemoCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKDemoCell.m
3 | // FeatureDemo
4 | //
5 | // Created by Kolin Krewinkel on 4/28/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import "KKDemoCell.h"
10 |
11 | @implementation KKDemoCell
12 | @synthesize label = _label;
13 |
14 | - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier
15 | {
16 | if ((self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier])) {
17 | _label = [[UILabel alloc] initWithFrame:CGRectMake(0.f, 0.f, self.frame.size.width, 14.f)];
18 | _label.backgroundColor = [UIColor lightGrayColor];
19 | _label.textAlignment = UITextAlignmentCenter;
20 | [self.contentView addSubview:_label];
21 | }
22 |
23 | return self;
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/KKDetailViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKDetailViewController.h
3 | // FeatureDemo
4 | //
5 | // Created by Kolin Krewinkel on 4/28/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface KKDetailViewController : KKGridViewController
13 |
14 | @property (nonatomic, strong) NSMutableArray *fillerData;
15 | @end
16 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/KKDetailViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKDetailViewController.m
3 | // FeatureDemo
4 | //
5 | // Created by Kolin Krewinkel on 4/28/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import "KKDetailViewController.h"
10 | #import "KKDemoCell.h"
11 |
12 | @interface KKDetailViewController ()
13 |
14 | @property (strong, nonatomic) UIPopoverController *masterPopoverController;
15 |
16 | @end
17 |
18 | @implementation KKDetailViewController
19 |
20 | @synthesize fillerData = _fillerData;
21 |
22 | #pragma mark - Initialization
23 |
24 | - (void)viewDidLoad
25 | {
26 | [super viewDidLoad];
27 |
28 | UIView *backgroundView = [[UIView alloc] init];
29 | backgroundView.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
30 | self.gridView.backgroundView = backgroundView;
31 |
32 | self.gridView.cellPadding = CGSizeMake(11.f, 5.f);
33 | self.title = @"KKGridView";
34 |
35 | _fillerData = [[NSMutableArray alloc] init];
36 | for (NSUInteger i = 0; i < 20; i++) {
37 | NSMutableArray *array = [[NSMutableArray alloc] init];
38 | for (NSUInteger j = 0; j < 20; j++) {
39 | [array addObject:[NSString stringWithFormat:@"%u", j]];
40 | }
41 |
42 | [_fillerData addObject:array];
43 | }
44 |
45 | [self.gridView reloadData];
46 | }
47 |
48 | #pragma mark - KKGridView
49 |
50 | - (NSUInteger)numberOfSectionsInGridView:(KKGridView *)gridView
51 | {
52 | return _fillerData.count;
53 | }
54 |
55 | - (NSUInteger)gridView:(KKGridView *)gridView numberOfItemsInSection:(NSUInteger)section
56 | {
57 | return [[_fillerData objectAtIndex:section] count];
58 | }
59 |
60 | - (NSString *)gridView:(KKGridView *)gridView titleForHeaderInSection:(NSUInteger)section
61 | {
62 | return [NSString stringWithFormat:@"%u", section + 1];
63 | }
64 |
65 | - (KKGridViewCell *)gridView:(KKGridView *)gridView cellForItemAtIndexPath:(KKIndexPath *)indexPath
66 | {
67 | KKDemoCell *cell = [KKDemoCell cellForGridView:gridView];
68 | cell.label.text = [NSString stringWithFormat:@"%u", indexPath.index];
69 |
70 | CGFloat percentage = (CGFloat)indexPath.index / (CGFloat)[[_fillerData objectAtIndex:indexPath.section] count];
71 | cell.contentView.backgroundColor = [UIColor colorWithWhite:percentage alpha:1.f];
72 |
73 | return cell;
74 | }
75 |
76 | #pragma mark - Cleanup
77 |
78 | - (void)viewDidUnload
79 | {
80 | [super viewDidUnload];
81 | }
82 |
83 | #pragma mark - UIViewController
84 |
85 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
86 | {
87 | return YES;
88 | }
89 |
90 | #pragma mark - Split view
91 |
92 | - (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
93 | {
94 | barButtonItem.title = NSLocalizedString(@"Master", @"Master");
95 | [self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
96 | self.masterPopoverController = popoverController;
97 | }
98 |
99 | - (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
100 | {
101 | // Called when the view is shown again in the split view, invalidating the button and popover controller.
102 | [self.navigationItem setLeftBarButtonItem:nil animated:YES];
103 | self.masterPopoverController = nil;
104 | }
105 |
106 | @end
107 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/KKMasterViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKMasterViewController.h
3 | // FeatureDemo
4 | //
5 | // Created by Kolin Krewinkel on 4/28/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class KKDetailViewController;
12 |
13 | @interface KKMasterViewController : UITableViewController
14 |
15 | @property (strong, nonatomic) KKDetailViewController *detailViewController;
16 |
17 | - (void)_dispatchActionForIndexPath:(NSIndexPath *)indexPath;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/KKMasterViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKMasterViewController.m
3 | // FeatureDemo
4 | //
5 | // Created by Kolin Krewinkel on 4/28/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import "KKMasterViewController.h"
10 |
11 | #import "KKDetailViewController.h"
12 |
13 | @interface KKMasterViewController () {
14 | NSMutableArray *_objects;
15 | }
16 | @end
17 |
18 | @implementation KKMasterViewController
19 |
20 | #pragma mark - Initialization
21 |
22 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
23 | {
24 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
25 | self.title = @"Controller";
26 | self.clearsSelectionOnViewWillAppear = NO;
27 | self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
28 | }
29 | return self;
30 | }
31 |
32 |
33 |
34 | #pragma mark - Cleanup
35 |
36 | - (void)viewDidUnload
37 | {
38 | [super viewDidUnload];
39 | }
40 |
41 | #pragma mark - UIViewController
42 |
43 | - (void)viewDidLoad
44 | {
45 | [super viewDidLoad];
46 | _objects = [[NSMutableArray alloc] initWithArray:@[@"Add Items", @"Remove Items", @"Add Section", @"Remove Section", @"Move Items", @"Multiple Selection", @"Background View", @"Begin Updates"]];
47 | }
48 |
49 | - (void)viewDidAppear:(BOOL)animated
50 | {
51 | [super viewDidAppear:animated];
52 | [self.tableView reloadData];
53 | }
54 |
55 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
56 | {
57 | return YES;
58 | }
59 |
60 | #pragma mark - Table View
61 |
62 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
63 | {
64 | return 1;
65 | }
66 |
67 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
68 | {
69 | return _objects.count;
70 | }
71 |
72 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
73 | {
74 | static NSString *CellIdentifier = @"Cell";
75 |
76 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
77 | if (cell == nil) {
78 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
79 | }
80 |
81 | cell.textLabel.text = [_objects objectAtIndex:indexPath.row];
82 |
83 | if (indexPath.row == 5) {
84 | cell.accessoryType = self.detailViewController.gridView.allowsMultipleSelection ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
85 | } else if (indexPath.row == 6) {
86 | cell.accessoryType = self.detailViewController.gridView.backgroundView ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
87 | } else if (indexPath.row == 7) {
88 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
89 | cell.textLabel.text = self.detailViewController.gridView.batchUpdating ? @"End Updates" : @"Begin Updates";
90 | }
91 |
92 | return cell;
93 | }
94 |
95 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
96 | {
97 | [self _dispatchActionForIndexPath:indexPath];
98 | [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
99 | [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
100 | }
101 |
102 | #pragma mark - Grid View
103 |
104 | - (void)_dispatchActionForIndexPath:(NSIndexPath *)indexPath
105 | {
106 | KKGridView *gridView = self.detailViewController.gridView;
107 |
108 | switch (indexPath.row) {
109 | case 0: {
110 | NSMutableSet *set = [[NSMutableSet alloc] init];
111 | for (NSIndexPath *indexPath in [gridView visibleIndexPaths]) {
112 | [set addObject:[NSNumber numberWithUnsignedInteger:indexPath.section]];
113 | }
114 |
115 | NSArray *sections = [set allObjects];
116 | NSMutableArray *indexPaths = [[NSMutableArray alloc] init];
117 |
118 | for (NSString *section in sections) {
119 | [indexPaths addObject:[KKIndexPath indexPathForIndex:0 inSection:[section integerValue]]];
120 | NSMutableArray *array = [self.detailViewController.fillerData objectAtIndex:[section integerValue]];
121 | [array addObject:[NSString stringWithFormat:@"%u", [array count]]];
122 | }
123 |
124 |
125 | [gridView insertItemsAtIndexPaths:indexPaths withAnimation:KKGridViewAnimationExplode];
126 |
127 | break;
128 | } case 5: {
129 | gridView.allowsMultipleSelection = !gridView.allowsMultipleSelection;
130 | break;
131 | } case 6: {
132 | UIView *backgroundView = nil;
133 | if (!gridView.backgroundView) {
134 | backgroundView = [[UIView alloc] init];
135 | backgroundView.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
136 | }
137 |
138 | gridView.backgroundView = gridView.backgroundView ? nil : backgroundView;
139 |
140 | break;
141 | } case 7: {
142 |
143 | if (!gridView.batchUpdating)
144 | [gridView beginUpdates];
145 | else
146 | [gridView endUpdates];
147 |
148 | break;
149 | }
150 | default:
151 | break;
152 | }
153 | }
154 |
155 | @end
156 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/en.lproj/KKDetailViewController.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1296
5 | 12A178q
6 | 2488
7 | 1166.3
8 | 609.00
9 |
13 |
14 | IBProxyObject
15 | IBUIView
16 |
17 |
18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
19 |
20 |
24 |
25 |
29 |
33 |
50 |
51 |
52 |
53 |
54 |
55 | view
56 |
57 |
58 |
59 | 12
60 |
61 |
62 |
63 |
64 |
65 | 0
66 |
67 |
68 |
69 |
70 |
71 | -1
72 |
73 |
74 | File's Owner
75 |
76 |
77 | -2
78 |
79 |
80 |
81 |
82 | 8
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | KKDetailViewController
91 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
92 | UIResponder
93 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
94 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
95 |
96 |
97 |
98 |
99 |
100 | 66
101 |
102 |
103 |
104 |
105 | KKDetailViewController
106 | KKGridViewController
107 |
108 | UILabel
109 | id
110 | UIToolbar
111 |
112 |
113 |
114 | detailDescriptionLabel
115 | UILabel
116 |
117 |
118 | detailItem
119 | id
120 |
121 |
122 | toolbar
123 | UIToolbar
124 |
125 |
126 |
127 | IBProjectSource
128 | ./Classes/KKDetailViewController.h
129 |
130 |
131 |
132 | KKGridViewController
133 | UIViewController
134 |
135 | IBProjectSource
136 | ./Classes/KKGridViewController.h
137 |
138 |
139 |
140 |
141 | 0
142 | IBIPadFramework
143 |
144 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS
145 |
146 |
147 | YES
148 | 3
149 | 1468
150 |
151 |
152 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/en.lproj/KKMasterViewController.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1280
5 | 11C25
6 | 1919
7 | 1138.11
8 | 566.00
9 |
10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
11 | 916
12 |
13 |
14 | IBProxyObject
15 | IBUITableView
16 |
17 |
18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
19 |
20 |
21 | PluginDependencyRecalculationVersion
22 |
23 |
24 |
25 |
26 | IBFilesOwner
27 | IBIPadFramework
28 |
29 |
30 | IBFirstResponder
31 | IBIPadFramework
32 |
33 |
34 |
35 | 274
36 | {{0, 20}, {320, 832}}
37 |
38 |
39 |
40 | 3
41 | MQA
42 |
43 | YES
44 |
45 | 2
46 |
47 |
48 | IBUISplitViewMasterSimulatedSizeMetrics
49 |
50 | YES
51 |
52 |
53 |
54 |
55 |
56 | {320, 852}
57 | {320, 768}
58 |
59 |
60 | IBIPadFramework
61 | Master
62 | IBUISplitViewController
63 |
64 | IBUISplitViewControllerContentSizeLocation
65 | IBUISplitViewControllerContentSizeLocationMaster
66 |
67 |
68 | IBIPadFramework
69 | YES
70 | 1
71 | 0
72 | YES
73 | 44
74 | 22
75 | 22
76 |
77 |
78 |
79 |
80 |
81 |
82 | view
83 |
84 |
85 |
86 | 3
87 |
88 |
89 |
90 | dataSource
91 |
92 |
93 |
94 | 4
95 |
96 |
97 |
98 | delegate
99 |
100 |
101 |
102 | 5
103 |
104 |
105 |
106 |
107 |
108 | 0
109 |
110 |
111 |
112 |
113 |
114 | -1
115 |
116 |
117 | File's Owner
118 |
119 |
120 | -2
121 |
122 |
123 |
124 |
125 | 2
126 |
127 |
128 |
129 |
130 |
131 |
132 | KKMasterViewController
133 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
134 | UIResponder
135 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
136 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
137 |
138 |
139 |
140 |
141 |
142 | 5
143 |
144 |
145 |
146 |
147 | KKMasterViewController
148 | UITableViewController
149 |
150 | IBProjectSource
151 | ./Classes/KKMasterViewController.h
152 |
153 |
154 |
155 |
156 | 0
157 | IBIPadFramework
158 | YES
159 | 3
160 | 916
161 |
162 |
163 |
--------------------------------------------------------------------------------
/Examples/FeatureDemo/FeatureDemo/FeatureDemo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // FeatureDemo
4 | //
5 | // Created by Kolin Krewinkel on 4/28/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "KKAppDelegate.h"
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([KKAppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/Default-Landscape@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/Examples/GridViewDemo/Default-Landscape@2x.png
--------------------------------------------------------------------------------
/Examples/GridViewDemo/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/Examples/GridViewDemo/Default@2x.png
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1A530A2E13DE962700E6C60B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A530A2D13DE962700E6C60B /* UIKit.framework */; };
11 | 1A530A3013DE962700E6C60B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A530A2F13DE962700E6C60B /* Foundation.framework */; };
12 | 1A530A3213DE962700E6C60B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A530A3113DE962700E6C60B /* CoreGraphics.framework */; };
13 | 1A530A3813DE962700E6C60B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1A530A3613DE962700E6C60B /* InfoPlist.strings */; };
14 | 1A530A3A13DE962700E6C60B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A530A3913DE962700E6C60B /* main.m */; };
15 | 1A530A3E13DE962700E6C60B /* GridViewDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A530A3D13DE962700E6C60B /* GridViewDemoAppDelegate.m */; };
16 | 1A530A4113DE962700E6C60B /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1A530A3F13DE962700E6C60B /* MainWindow.xib */; };
17 | 1A530A4413DE962700E6C60B /* GridViewDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A530A4313DE962700E6C60B /* GridViewDemoViewController.m */; };
18 | 1A530A4713DE962700E6C60B /* GridViewDemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1A530A4513DE962700E6C60B /* GridViewDemoViewController.xib */; };
19 | 1A72A97A1453B450002546F8 /* libKKGridView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A72A9791453B450002546F8 /* libKKGridView.a */; };
20 | 1A75378F148F070D00B8A777 /* KKGridViewIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A75378D148F070D00B8A777 /* KKGridViewIcon.png */; };
21 | 1A753790148F070D00B8A777 /* KKGridViewIcon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A75378E148F070D00B8A777 /* KKGridViewIcon@2x.png */; };
22 | 1A753798148F1B6300B8A777 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A753796148F1B6300B8A777 /* Default.png */; };
23 | 3330C714153536D90054B29A /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3330C713153536D90054B29A /* AssetsLibrary.framework */; };
24 | 397E3D281406642500C3DEA3 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 397E3D271406642500C3DEA3 /* QuartzCore.framework */; };
25 | 5674016D14AACDF300A838F8 /* KKGridView.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 5674016C14AACDF300A838F8 /* KKGridView.bundle */; };
26 | FC35C029149C70F100A56750 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC35C028149C70F100A56750 /* Default@2x.png */; };
27 | FC35C02B149C710000A56750 /* Default-Landscape@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC35C02A149C710000A56750 /* Default-Landscape@2x.png */; };
28 | /* End PBXBuildFile section */
29 |
30 | /* Begin PBXFileReference section */
31 | 1A530A2913DE962700E6C60B /* GridViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GridViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
32 | 1A530A2D13DE962700E6C60B /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
33 | 1A530A2F13DE962700E6C60B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
34 | 1A530A3113DE962700E6C60B /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
35 | 1A530A3513DE962700E6C60B /* GridViewDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GridViewDemo-Info.plist"; sourceTree = ""; };
36 | 1A530A3713DE962700E6C60B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
37 | 1A530A3913DE962700E6C60B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
38 | 1A530A3B13DE962700E6C60B /* GridViewDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GridViewDemo-Prefix.pch"; sourceTree = ""; };
39 | 1A530A3C13DE962700E6C60B /* GridViewDemoAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GridViewDemoAppDelegate.h; sourceTree = ""; };
40 | 1A530A3D13DE962700E6C60B /* GridViewDemoAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GridViewDemoAppDelegate.m; sourceTree = ""; };
41 | 1A530A4013DE962700E6C60B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; };
42 | 1A530A4213DE962700E6C60B /* GridViewDemoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GridViewDemoViewController.h; sourceTree = ""; };
43 | 1A530A4313DE962700E6C60B /* GridViewDemoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GridViewDemoViewController.m; sourceTree = ""; };
44 | 1A530A4613DE962700E6C60B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/GridViewDemoViewController.xib; sourceTree = ""; };
45 | 1A72A9791453B450002546F8 /* libKKGridView.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libKKGridView.a; sourceTree = BUILT_PRODUCTS_DIR; };
46 | 1A75378D148F070D00B8A777 /* KKGridViewIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = KKGridViewIcon.png; sourceTree = ""; };
47 | 1A75378E148F070D00B8A777 /* KKGridViewIcon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "KKGridViewIcon@2x.png"; sourceTree = ""; };
48 | 1A753796148F1B6300B8A777 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; };
49 | 3330C713153536D90054B29A /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
50 | 339238B3154A52D600C8F90C /* GridViewDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = GridViewDemo.entitlements; sourceTree = ""; };
51 | 397E3D271406642500C3DEA3 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
52 | 5674016C14AACDF300A838F8 /* KKGridView.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = KKGridView.bundle; path = ../../../../KKGridView/KKGridView.bundle; sourceTree = ""; };
53 | FC35C028149C70F100A56750 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = SOURCE_ROOT; };
54 | FC35C02A149C710000A56750 /* Default-Landscape@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape@2x.png"; sourceTree = SOURCE_ROOT; };
55 | /* End PBXFileReference section */
56 |
57 | /* Begin PBXFrameworksBuildPhase section */
58 | 1A530A2613DE962700E6C60B /* Frameworks */ = {
59 | isa = PBXFrameworksBuildPhase;
60 | buildActionMask = 2147483647;
61 | files = (
62 | 1A72A97A1453B450002546F8 /* libKKGridView.a in Frameworks */,
63 | 3330C714153536D90054B29A /* AssetsLibrary.framework in Frameworks */,
64 | 1A530A3213DE962700E6C60B /* CoreGraphics.framework in Frameworks */,
65 | 1A530A3013DE962700E6C60B /* Foundation.framework in Frameworks */,
66 | 397E3D281406642500C3DEA3 /* QuartzCore.framework in Frameworks */,
67 | 1A530A2E13DE962700E6C60B /* UIKit.framework in Frameworks */,
68 | );
69 | runOnlyForDeploymentPostprocessing = 0;
70 | };
71 | /* End PBXFrameworksBuildPhase section */
72 |
73 | /* Begin PBXGroup section */
74 | 1A530A1E13DE962700E6C60B = {
75 | isa = PBXGroup;
76 | children = (
77 | 1A530A3313DE962700E6C60B /* GridViewDemo */,
78 | 1A530A2C13DE962700E6C60B /* Frameworks */,
79 | 1A530A2A13DE962700E6C60B /* Products */,
80 | );
81 | indentWidth = 4;
82 | sourceTree = "";
83 | tabWidth = 4;
84 | };
85 | 1A530A2A13DE962700E6C60B /* Products */ = {
86 | isa = PBXGroup;
87 | children = (
88 | 1A530A2913DE962700E6C60B /* GridViewDemo.app */,
89 | );
90 | name = Products;
91 | sourceTree = "";
92 | };
93 | 1A530A2C13DE962700E6C60B /* Frameworks */ = {
94 | isa = PBXGroup;
95 | children = (
96 | 1A72A9791453B450002546F8 /* libKKGridView.a */,
97 | 3330C713153536D90054B29A /* AssetsLibrary.framework */,
98 | 1A530A3113DE962700E6C60B /* CoreGraphics.framework */,
99 | 1A530A2F13DE962700E6C60B /* Foundation.framework */,
100 | 397E3D271406642500C3DEA3 /* QuartzCore.framework */,
101 | 1A530A2D13DE962700E6C60B /* UIKit.framework */,
102 | );
103 | name = Frameworks;
104 | sourceTree = "";
105 | };
106 | 1A530A3313DE962700E6C60B /* GridViewDemo */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 339238B3154A52D600C8F90C /* GridViewDemo.entitlements */,
110 | 1A530A3C13DE962700E6C60B /* GridViewDemoAppDelegate.h */,
111 | 1A530A3D13DE962700E6C60B /* GridViewDemoAppDelegate.m */,
112 | 1A530A4213DE962700E6C60B /* GridViewDemoViewController.h */,
113 | 1A530A4313DE962700E6C60B /* GridViewDemoViewController.m */,
114 | 1A530A4513DE962700E6C60B /* GridViewDemoViewController.xib */,
115 | 1A530A3F13DE962700E6C60B /* MainWindow.xib */,
116 | 1A75378C148F070D00B8A777 /* Resources */,
117 | 1A530A3413DE962700E6C60B /* Supporting Files */,
118 | );
119 | path = GridViewDemo;
120 | sourceTree = "";
121 | };
122 | 1A530A3413DE962700E6C60B /* Supporting Files */ = {
123 | isa = PBXGroup;
124 | children = (
125 | 1A530A3513DE962700E6C60B /* GridViewDemo-Info.plist */,
126 | 1A530A3B13DE962700E6C60B /* GridViewDemo-Prefix.pch */,
127 | 1A530A3613DE962700E6C60B /* InfoPlist.strings */,
128 | 1A530A3913DE962700E6C60B /* main.m */,
129 | );
130 | name = "Supporting Files";
131 | sourceTree = "";
132 | };
133 | 1A75378C148F070D00B8A777 /* Resources */ = {
134 | isa = PBXGroup;
135 | children = (
136 | 5674016C14AACDF300A838F8 /* KKGridView.bundle */,
137 | FC35C02A149C710000A56750 /* Default-Landscape@2x.png */,
138 | FC35C028149C70F100A56750 /* Default@2x.png */,
139 | 1A753796148F1B6300B8A777 /* Default.png */,
140 | 1A75378D148F070D00B8A777 /* KKGridViewIcon.png */,
141 | 1A75378E148F070D00B8A777 /* KKGridViewIcon@2x.png */,
142 | );
143 | path = Resources;
144 | sourceTree = "";
145 | };
146 | /* End PBXGroup section */
147 |
148 | /* Begin PBXNativeTarget section */
149 | 1A530A2813DE962700E6C60B /* GridViewDemo */ = {
150 | isa = PBXNativeTarget;
151 | buildConfigurationList = 1A530A4A13DE962700E6C60B /* Build configuration list for PBXNativeTarget "GridViewDemo" */;
152 | buildPhases = (
153 | 1A530A2513DE962700E6C60B /* Sources */,
154 | 1A530A2613DE962700E6C60B /* Frameworks */,
155 | 1A530A2713DE962700E6C60B /* Resources */,
156 | );
157 | buildRules = (
158 | );
159 | dependencies = (
160 | );
161 | name = GridViewDemo;
162 | productName = GridViewDemo;
163 | productReference = 1A530A2913DE962700E6C60B /* GridViewDemo.app */;
164 | productType = "com.apple.product-type.application";
165 | };
166 | /* End PBXNativeTarget section */
167 |
168 | /* Begin PBXProject section */
169 | 1A530A2013DE962700E6C60B /* Project object */ = {
170 | isa = PBXProject;
171 | attributes = {
172 | LastUpgradeCheck = 0440;
173 | ORGANIZATIONNAME = "kxk design";
174 | };
175 | buildConfigurationList = 1A530A2313DE962700E6C60B /* Build configuration list for PBXProject "GridViewDemo" */;
176 | compatibilityVersion = "Xcode 3.2";
177 | developmentRegion = English;
178 | hasScannedForEncodings = 0;
179 | knownRegions = (
180 | en,
181 | );
182 | mainGroup = 1A530A1E13DE962700E6C60B;
183 | productRefGroup = 1A530A2A13DE962700E6C60B /* Products */;
184 | projectDirPath = "";
185 | projectRoot = "";
186 | targets = (
187 | 1A530A2813DE962700E6C60B /* GridViewDemo */,
188 | );
189 | };
190 | /* End PBXProject section */
191 |
192 | /* Begin PBXResourcesBuildPhase section */
193 | 1A530A2713DE962700E6C60B /* Resources */ = {
194 | isa = PBXResourcesBuildPhase;
195 | buildActionMask = 2147483647;
196 | files = (
197 | 1A530A3813DE962700E6C60B /* InfoPlist.strings in Resources */,
198 | 1A530A4113DE962700E6C60B /* MainWindow.xib in Resources */,
199 | 1A530A4713DE962700E6C60B /* GridViewDemoViewController.xib in Resources */,
200 | 1A75378F148F070D00B8A777 /* KKGridViewIcon.png in Resources */,
201 | 1A753790148F070D00B8A777 /* KKGridViewIcon@2x.png in Resources */,
202 | 1A753798148F1B6300B8A777 /* Default.png in Resources */,
203 | FC35C029149C70F100A56750 /* Default@2x.png in Resources */,
204 | FC35C02B149C710000A56750 /* Default-Landscape@2x.png in Resources */,
205 | 5674016D14AACDF300A838F8 /* KKGridView.bundle in Resources */,
206 | );
207 | runOnlyForDeploymentPostprocessing = 0;
208 | };
209 | /* End PBXResourcesBuildPhase section */
210 |
211 | /* Begin PBXSourcesBuildPhase section */
212 | 1A530A2513DE962700E6C60B /* Sources */ = {
213 | isa = PBXSourcesBuildPhase;
214 | buildActionMask = 2147483647;
215 | files = (
216 | 1A530A3A13DE962700E6C60B /* main.m in Sources */,
217 | 1A530A3E13DE962700E6C60B /* GridViewDemoAppDelegate.m in Sources */,
218 | 1A530A4413DE962700E6C60B /* GridViewDemoViewController.m in Sources */,
219 | );
220 | runOnlyForDeploymentPostprocessing = 0;
221 | };
222 | /* End PBXSourcesBuildPhase section */
223 |
224 | /* Begin PBXVariantGroup section */
225 | 1A530A3613DE962700E6C60B /* InfoPlist.strings */ = {
226 | isa = PBXVariantGroup;
227 | children = (
228 | 1A530A3713DE962700E6C60B /* en */,
229 | );
230 | name = InfoPlist.strings;
231 | sourceTree = "";
232 | };
233 | 1A530A3F13DE962700E6C60B /* MainWindow.xib */ = {
234 | isa = PBXVariantGroup;
235 | children = (
236 | 1A530A4013DE962700E6C60B /* en */,
237 | );
238 | name = MainWindow.xib;
239 | sourceTree = "";
240 | };
241 | 1A530A4513DE962700E6C60B /* GridViewDemoViewController.xib */ = {
242 | isa = PBXVariantGroup;
243 | children = (
244 | 1A530A4613DE962700E6C60B /* en */,
245 | );
246 | name = GridViewDemoViewController.xib;
247 | sourceTree = "";
248 | };
249 | /* End PBXVariantGroup section */
250 |
251 | /* Begin XCBuildConfiguration section */
252 | 1A530A4813DE962700E6C60B /* Debug */ = {
253 | isa = XCBuildConfiguration;
254 | buildSettings = {
255 | ALWAYS_SEARCH_USER_PATHS = NO;
256 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
257 | CODE_SIGN_IDENTITY = "iPhone Developer: Kolin Krewinkel (539DMET925)";
258 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
259 | COPY_PHASE_STRIP = NO;
260 | GCC_C_LANGUAGE_STANDARD = gnu99;
261 | GCC_DYNAMIC_NO_PIC = NO;
262 | GCC_OPTIMIZATION_LEVEL = 0;
263 | GCC_PREPROCESSOR_DEFINITIONS = (
264 | "DEBUG=1",
265 | "$(inherited)",
266 | );
267 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
268 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
269 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
270 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
271 | GCC_WARN_UNUSED_VARIABLE = YES;
272 | IPHONEOS_DEPLOYMENT_TARGET = 4.3;
273 | PROVISIONING_PROFILE = "7ED8A7A7-FE54-4652-B491-CF47D9B416BB";
274 | SDKROOT = iphoneos;
275 | };
276 | name = Debug;
277 | };
278 | 1A530A4913DE962700E6C60B /* Release */ = {
279 | isa = XCBuildConfiguration;
280 | buildSettings = {
281 | ALWAYS_SEARCH_USER_PATHS = NO;
282 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
283 | CODE_SIGN_IDENTITY = "iPhone Developer: Kolin Krewinkel (539DMET925)";
284 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
285 | COPY_PHASE_STRIP = YES;
286 | GCC_C_LANGUAGE_STANDARD = gnu99;
287 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
288 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
289 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
290 | GCC_WARN_UNUSED_VARIABLE = YES;
291 | IPHONEOS_DEPLOYMENT_TARGET = 4.3;
292 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
293 | PROVISIONING_PROFILE = "7ED8A7A7-FE54-4652-B491-CF47D9B416BB";
294 | SDKROOT = iphoneos;
295 | VALIDATE_PRODUCT = YES;
296 | };
297 | name = Release;
298 | };
299 | 1A530A4B13DE962700E6C60B /* Debug */ = {
300 | isa = XCBuildConfiguration;
301 | buildSettings = {
302 | ARCHS = (
303 | "$(ARCHS_STANDARD_32_BIT)",
304 | armv6,
305 | );
306 | CLANG_ENABLE_OBJC_ARC = YES;
307 | CODE_SIGN_ENTITLEMENTS = GridViewDemo/GridViewDemo.entitlements;
308 | CODE_SIGN_IDENTITY = "iPhone Developer";
309 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
310 | GCC_PREFIX_HEADER = "GridViewDemo/GridViewDemo-Prefix.pch";
311 | GCC_THUMB_SUPPORT = NO;
312 | INFOPLIST_FILE = "GridViewDemo/GridViewDemo-Info.plist";
313 | IPHONEOS_DEPLOYMENT_TARGET = 4.0;
314 | OTHER_LDFLAGS = (
315 | "-all_load",
316 | "-ObjC",
317 | );
318 | PRODUCT_NAME = "$(TARGET_NAME)";
319 | PROVISIONING_PROFILE = "";
320 | SDKROOT = iphoneos;
321 | TARGETED_DEVICE_FAMILY = "1,2";
322 | WRAPPER_EXTENSION = app;
323 | };
324 | name = Debug;
325 | };
326 | 1A530A4C13DE962700E6C60B /* Release */ = {
327 | isa = XCBuildConfiguration;
328 | buildSettings = {
329 | ARCHS = (
330 | "$(ARCHS_STANDARD_32_BIT)",
331 | armv6,
332 | );
333 | CLANG_ENABLE_OBJC_ARC = YES;
334 | CODE_SIGN_ENTITLEMENTS = GridViewDemo/GridViewDemo.entitlements;
335 | CODE_SIGN_IDENTITY = "iPhone Developer";
336 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
337 | GCC_PREFIX_HEADER = "GridViewDemo/GridViewDemo-Prefix.pch";
338 | GCC_THUMB_SUPPORT = NO;
339 | INFOPLIST_FILE = "GridViewDemo/GridViewDemo-Info.plist";
340 | IPHONEOS_DEPLOYMENT_TARGET = 4.0;
341 | OTHER_LDFLAGS = (
342 | "-all_load",
343 | "-ObjC",
344 | );
345 | PRODUCT_NAME = "$(TARGET_NAME)";
346 | PROVISIONING_PROFILE = "";
347 | SDKROOT = iphoneos;
348 | TARGETED_DEVICE_FAMILY = "1,2";
349 | WRAPPER_EXTENSION = app;
350 | };
351 | name = Release;
352 | };
353 | /* End XCBuildConfiguration section */
354 |
355 | /* Begin XCConfigurationList section */
356 | 1A530A2313DE962700E6C60B /* Build configuration list for PBXProject "GridViewDemo" */ = {
357 | isa = XCConfigurationList;
358 | buildConfigurations = (
359 | 1A530A4813DE962700E6C60B /* Debug */,
360 | 1A530A4913DE962700E6C60B /* Release */,
361 | );
362 | defaultConfigurationIsVisible = 0;
363 | defaultConfigurationName = Release;
364 | };
365 | 1A530A4A13DE962700E6C60B /* Build configuration list for PBXNativeTarget "GridViewDemo" */ = {
366 | isa = XCConfigurationList;
367 | buildConfigurations = (
368 | 1A530A4B13DE962700E6C60B /* Debug */,
369 | 1A530A4C13DE962700E6C60B /* Release */,
370 | );
371 | defaultConfigurationIsVisible = 0;
372 | defaultConfigurationName = Release;
373 | };
374 | /* End XCConfigurationList section */
375 | };
376 | rootObject = 1A530A2013DE962700E6C60B /* Project object */;
377 | }
378 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo.xcworkspace/xcshareddata/xcschemes/GridViewDemo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
46 |
47 |
53 |
54 |
55 |
56 |
65 |
66 |
72 |
73 |
74 |
75 |
76 |
77 |
83 |
84 |
90 |
91 |
92 |
93 |
95 |
96 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo.xcworkspace/xcshareddata/xcschemes/KKGridView.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
42 |
43 |
44 |
45 |
51 |
52 |
54 |
55 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/GridViewDemo-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | KKGridDemo
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 |
13 | CFBundleIconFiles
14 |
15 | KKGridViewIcon.png
16 | KKGridViewIcon@2x.png
17 |
18 | CFBundleIcons
19 |
20 | CFBundlePrimaryIcon
21 |
22 | CFBundleIconFiles
23 |
24 | KKGridViewIcon.png
25 | KKGridViewIcon@2x.png
26 |
27 | UIPrerenderedIcon
28 |
29 |
30 |
31 | CFBundleIdentifier
32 | com.kolinkrewinkel.${PRODUCT_NAME:rfc1034identifier}
33 | CFBundleInfoDictionaryVersion
34 | 6.0
35 | CFBundleName
36 | ${PRODUCT_NAME}
37 | CFBundlePackageType
38 | APPL
39 | CFBundleShortVersionString
40 | 1.0
41 | CFBundleSignature
42 | ????
43 | CFBundleVersion
44 | 1.0
45 | LSRequiresIPhoneOS
46 |
47 | NSMainNibFile
48 | MainWindow
49 | UIStatusBarStyle
50 | UIStatusBarStyleBlackOpaque
51 | UISupportedInterfaceOrientations
52 |
53 | UIInterfaceOrientationPortrait
54 | UIInterfaceOrientationLandscapeLeft
55 | UIInterfaceOrientationLandscapeRight
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/GridViewDemo-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'GridViewDemo' target in the 'GridViewDemo' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #import
15 | #import
16 | #endif
17 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/GridViewDemo.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | DataProtectionClass
6 | NSFileProtectionComplete
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/GridViewDemoAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // GridViewDemoAppDelegate.h
3 | // GridViewDemo
4 | //
5 | // Created by Kolin Krewinkel on 7.25.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class GridViewDemoViewController;
12 |
13 | @interface GridViewDemoAppDelegate : NSObject
14 | @property (nonatomic, strong) IBOutlet UIWindow *window;
15 | @property (nonatomic, strong) IBOutlet GridViewDemoViewController *viewController;
16 | @end
17 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/GridViewDemoAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // GridViewDemoAppDelegate.m
3 | // GridViewDemo
4 | //
5 | // Created by Kolin Krewinkel on 7.25.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import "GridViewDemoAppDelegate.h"
10 | #import "GridViewDemoViewController.h"
11 |
12 | @implementation GridViewDemoAppDelegate
13 |
14 | @synthesize window = _window;
15 | @synthesize viewController = _viewController;
16 |
17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
18 | {
19 | // Override point for customization after application launch.
20 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
21 | self.window.rootViewController = navigationController;
22 | [self.window makeKeyAndVisible];
23 | return YES;
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/GridViewDemoViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // GridViewDemoViewController.h
3 | // GridViewDemo
4 | //
5 | // Created by Kolin Krewinkel on 7.25.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface GridViewDemoViewController : KKGridViewController
12 |
13 | @property (nonatomic) NSUInteger firstSectionCount;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/GridViewDemoViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // GridViewDemoViewController.m
3 | // GridViewDemo
4 | //
5 | // Created by Kolin Krewinkel on 7.25.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import "GridViewDemoViewController.h"
10 | #import
11 | #import
12 | #import
13 | #import
14 | #import
15 |
16 | static const NSUInteger kNumSection = 40;
17 |
18 | @implementation GridViewDemoViewController {
19 | ALAssetsLibrary *_assetsLibrary;
20 | NSMutableArray *_photoGroups;
21 | NSMutableArray *_assets;
22 | NSCache *_thumbnailCache;
23 | dispatch_queue_t _imageQueue;
24 | }
25 |
26 | @synthesize firstSectionCount = _firstSectionCount;
27 |
28 | #pragma mark - View lifecycle
29 |
30 | - (void)loadView
31 | {
32 | [super loadView];
33 |
34 | self.title = @"GridViewDemo - Photos";
35 |
36 | UIView *backgroundView = [[UIView alloc] init];
37 | backgroundView.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
38 | self.gridView.backgroundView = backgroundView;
39 |
40 | // Create the assets library object; retain it to deal with iOS's retardation.
41 | _assetsLibrary = [[ALAssetsLibrary alloc] init];
42 | // Enumerate through the user's photos.
43 | [_assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
44 |
45 | if (!_photoGroups)
46 | _photoGroups = [[NSMutableArray alloc] init];
47 |
48 | if (group)
49 | [_photoGroups addObject:group];
50 | else {
51 | for (ALAssetsGroup *group in _photoGroups) {
52 | if (!_assets)
53 | _assets = [[NSMutableArray alloc] init];
54 |
55 | // More enumeration bullshit.
56 | NSMutableArray *tempArray = [[NSMutableArray alloc] init];
57 | [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
58 | if (result)
59 | [tempArray addObject:result];
60 | else
61 | [_assets addObject:tempArray];
62 | }];
63 | }
64 | [self.gridView reloadData];
65 | _imageQueue = dispatch_queue_create("com.kolinkrewinkel.GridViewDemo", NULL);
66 |
67 | dispatch_sync(_imageQueue, ^(void) {
68 | if (!_thumbnailCache)
69 | _thumbnailCache = [[NSCache alloc] init]; // Thanks @indragie.
70 |
71 | NSUInteger section = 0;
72 | for (NSMutableArray *array in _assets) {
73 | NSUInteger index = 0;
74 | for (ALAsset *asset in array) {
75 | [_thumbnailCache setObject:[UIImage imageWithCGImage:[asset thumbnail]] forKey:asset]; // Store it!
76 | dispatch_async(dispatch_get_main_queue(), ^{
77 | [self.gridView reloadItemsAtIndexPaths:[NSArray arrayWithObject:[KKIndexPath indexPathForIndex:index inSection:section]]];
78 | });
79 | index++;
80 | }
81 | section++;
82 | }
83 | });
84 | }
85 |
86 | } failureBlock:^(NSError *error) {
87 | // I can't help you here, son.
88 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"LOLWAT" message:[NSString stringWithFormat:@"%@", [error localizedDescription]] delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
89 | [alert show];
90 | }];
91 | }
92 |
93 | #pragma mark - KKGridViewDataSource
94 |
95 | - (NSUInteger)numberOfSectionsInGridView:(KKGridView *)gridView
96 | {
97 | return _photoGroups.count;
98 | }
99 |
100 | - (NSUInteger)gridView:(KKGridView *)gridView numberOfItemsInSection:(NSUInteger)section
101 | {
102 | return [[_photoGroups objectAtIndex:section] numberOfAssets];
103 | }
104 |
105 | - (KKGridViewCell *)gridView:(KKGridView *)gridView cellForItemAtIndexPath:(KKIndexPath *)indexPath
106 | {
107 | KKGridViewCell *cell = [KKGridViewCell cellForGridView:gridView];
108 |
109 | ALAsset *asset = [[_assets objectAtIndex:indexPath.section] objectAtIndex:indexPath.index];
110 | cell.imageView.image = [_thumbnailCache objectForKey:asset];
111 |
112 | return cell;
113 | }
114 |
115 | - (CGFloat)gridView:(KKGridView *)gridView heightForHeaderInSection:(NSUInteger)section
116 | {
117 | return 23.f;
118 | }
119 |
120 | - (NSString *)gridView:(KKGridView *)gridView titleForHeaderInSection:(NSUInteger)section
121 | {
122 | return [[_photoGroups objectAtIndex:section] valueForProperty:ALAssetsGroupPropertyName];
123 | }
124 |
125 | - (NSArray *)sectionIndexTitlesForGridView:(KKGridView *)gridView {
126 | return [NSArray arrayWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",nil];
127 | }
128 |
129 | #pragma mark - UISearchBarDelegate
130 |
131 | - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
132 | {
133 | [searchBar resignFirstResponder];
134 | }
135 |
136 | #pragma mark - KKGridView Senders
137 |
138 | - (void)addItems:(id)sender
139 | {
140 | NSArray *items = [NSArray arrayWithObjects:[KKIndexPath indexPathForIndex:1 inSection:0], [KKIndexPath indexPathForIndex:2 inSection:0],/* [KKIndexPath indexPathForIndex:0 inSection:1],*/ nil];
141 |
142 | _firstSectionCount+= [items count];
143 | [self.gridView insertItemsAtIndexPaths:items withAnimation:KKGridViewAnimationExplode];
144 | }
145 |
146 | - (void)removeItems:(id)sender
147 | {
148 | NSArray *items = [NSArray arrayWithObjects:[KKIndexPath indexPathForIndex:0 inSection:0]/*, [KKIndexPath indexPathForIndex:3 inSection:0], [KKIndexPath indexPathForIndex:0 inSection:1]*/, nil];
149 |
150 | if (_firstSectionCount >= [items count] + 1) {
151 | _firstSectionCount-= [items count];
152 | [self.gridView deleteItemsAtIndexPaths:items withAnimation:KKGridViewAnimationExplode];
153 | } else {
154 | NSLog(@"Warning: can't remove any more objects here");
155 | }
156 | }
157 |
158 | //- (void)moveItems:(id)sender
159 | //{
160 | //// NSUInteger num = (arc4random() % 1) + 2;
161 | // KKIndexPath *indexPath = [KKIndexPath indexPathForIndex:1 inSection:0];
162 | // KKIndexPath *destinationPath = /*num == 1 ?*/ [KKIndexPath indexPathForIndex:2 inSection:0] /*: [KKIndexPath indexPathForIndex:2 inSection:2]*/;
163 | // [self.gridView moveItemAtIndexPath:indexPath toIndexPath:destinationPath];
164 | //}
165 |
166 | - (void)toggleSelectionStyle:(id)sender
167 | {
168 | self.gridView.allowsMultipleSelection = !self.gridView.allowsMultipleSelection;
169 | [self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:self.gridView.allowsMultipleSelection ? @"Disable Multiple Selection" : @"Enable Multiple Selection" style:UIBarButtonItemStyleBordered target:self action:@selector(toggleEditingStyle:)] animated:YES];
170 | }
171 |
172 | #pragma mark - UIViewController
173 |
174 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
175 | {
176 | // Please have your app conform to this.
177 |
178 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
179 | return YES;
180 |
181 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
182 | }
183 |
184 | - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
185 | {
186 | CATransition *fadeTransition = [CATransition animation];
187 | fadeTransition.duration = duration;
188 | fadeTransition.type = kCATransitionFade;
189 | fadeTransition.removedOnCompletion = YES;
190 | fadeTransition.fillMode = kCAFillModeForwards;
191 |
192 | for (CALayer *aLayer in self.gridView.layer.sublayers)
193 | [aLayer removeAllAnimations];
194 |
195 | [self.gridView.layer addAnimation:fadeTransition forKey:@"transition"];
196 | }
197 |
198 | @end
199 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/Resources/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/Examples/GridViewDemo/GridViewDemo/Resources/Default.png
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/Resources/KKGridViewIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/Examples/GridViewDemo/GridViewDemo/Resources/KKGridViewIcon.png
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/Resources/KKGridViewIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/Examples/GridViewDemo/GridViewDemo/Resources/KKGridViewIcon@2x.png
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/en.lproj/GridViewDemoViewController.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 800
5 | 10C540
6 | 759
7 | 1038.25
8 | 458.00
9 |
10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
11 | 77
12 |
13 |
14 | YES
15 |
16 |
17 |
18 | YES
19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
20 |
21 |
22 | YES
23 |
24 | YES
25 |
26 |
27 | YES
28 |
29 |
30 |
31 | YES
32 |
33 | IBFilesOwner
34 | IBCocoaTouchFramework
35 |
36 |
37 | IBFirstResponder
38 | IBCocoaTouchFramework
39 |
40 |
41 |
42 | 274
43 | {320, 460}
44 |
45 |
46 | 3
47 | MC43NQA
48 |
49 | 2
50 |
51 |
52 | NO
53 |
54 | IBCocoaTouchFramework
55 |
56 |
57 |
58 |
59 | YES
60 |
61 |
62 | view
63 |
64 |
65 |
66 | 7
67 |
68 |
69 |
70 |
71 | YES
72 |
73 | 0
74 |
75 |
76 |
77 |
78 |
79 | -1
80 |
81 |
82 | File's Owner
83 |
84 |
85 | -2
86 |
87 |
88 |
89 |
90 | 6
91 |
92 |
93 |
94 |
95 |
96 |
97 | YES
98 |
99 | YES
100 | -1.CustomClassName
101 | -2.CustomClassName
102 | 6.IBEditorWindowLastContentRect
103 | 6.IBPluginDependency
104 |
105 |
106 | YES
107 | GridViewDemoViewController
108 | UIResponder
109 | {{239, 654}, {320, 480}}
110 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
111 |
112 |
113 |
114 | YES
115 |
116 |
117 | YES
118 |
119 |
120 |
121 |
122 | YES
123 |
124 |
125 | YES
126 |
127 |
128 |
129 | 7
130 |
131 |
132 |
133 | YES
134 |
135 | GridViewDemoViewController
136 | UIViewController
137 |
138 | IBProjectSource
139 | GridViewDemoViewController.h
140 |
141 |
142 |
143 |
144 | 0
145 | IBCocoaTouchFramework
146 |
147 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3
148 |
149 |
150 | YES
151 | GridViewDemo.xcodeproj
152 | 3
153 | 77
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/en.lproj/MainWindow.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1024
5 | 10D571
6 | 786
7 | 1038.29
8 | 460.00
9 |
10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
11 | 112
12 |
13 |
14 | YES
15 |
16 |
17 |
18 | YES
19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
20 |
21 |
22 | YES
23 |
24 | YES
25 |
26 |
27 | YES
28 |
29 |
30 |
31 | YES
32 |
33 | IBFilesOwner
34 | IBCocoaTouchFramework
35 |
36 |
37 | IBFirstResponder
38 | IBCocoaTouchFramework
39 |
40 |
41 | IBCocoaTouchFramework
42 |
43 |
44 | GridViewDemoViewController
45 |
46 |
47 | 1
48 |
49 | IBCocoaTouchFramework
50 | NO
51 |
52 |
53 |
54 | 292
55 | {320, 480}
56 |
57 | 1
58 | MSAxIDEAA
59 |
60 | NO
61 | NO
62 |
63 | IBCocoaTouchFramework
64 | YES
65 |
66 |
67 |
68 |
69 | YES
70 |
71 |
72 | delegate
73 |
74 |
75 |
76 | 4
77 |
78 |
79 |
80 | viewController
81 |
82 |
83 |
84 | 11
85 |
86 |
87 |
88 | window
89 |
90 |
91 |
92 | 14
93 |
94 |
95 |
96 |
97 | YES
98 |
99 | 0
100 |
101 |
102 |
103 |
104 |
105 | -1
106 |
107 |
108 | File's Owner
109 |
110 |
111 | 3
112 |
113 |
114 | GridViewDemo App Delegate
115 |
116 |
117 | -2
118 |
119 |
120 |
121 |
122 | 10
123 |
124 |
125 |
126 |
127 | 12
128 |
129 |
130 |
131 |
132 |
133 |
134 | YES
135 |
136 | YES
137 | -1.CustomClassName
138 | -2.CustomClassName
139 | 10.CustomClassName
140 | 10.IBEditorWindowLastContentRect
141 | 10.IBPluginDependency
142 | 12.IBEditorWindowLastContentRect
143 | 12.IBPluginDependency
144 | 3.CustomClassName
145 | 3.IBPluginDependency
146 |
147 |
148 | YES
149 | UIApplication
150 | UIResponder
151 | GridViewDemoViewController
152 | {{234, 376}, {320, 480}}
153 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
154 | {{525, 346}, {320, 480}}
155 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
156 | GridViewDemoAppDelegate
157 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
158 |
159 |
160 |
161 | YES
162 |
163 |
164 | YES
165 |
166 |
167 |
168 |
169 | YES
170 |
171 |
172 | YES
173 |
174 |
175 |
176 | 15
177 |
178 |
179 |
180 | YES
181 |
182 | UIWindow
183 | UIView
184 |
185 | IBUserSource
186 |
187 |
188 |
189 |
190 | GridViewDemoAppDelegate
191 | NSObject
192 |
193 | YES
194 |
195 | YES
196 | viewController
197 | window
198 |
199 |
200 | YES
201 | GridViewDemoViewController
202 | UIWindow
203 |
204 |
205 |
206 | YES
207 |
208 | YES
209 | viewController
210 | window
211 |
212 |
213 | YES
214 |
215 | viewController
216 | GridViewDemoViewController
217 |
218 |
219 | window
220 | UIWindow
221 |
222 |
223 |
224 |
225 | IBProjectSource
226 | GridViewDemoAppDelegate.h
227 |
228 |
229 |
230 | GridViewDemoAppDelegate
231 | NSObject
232 |
233 | IBUserSource
234 |
235 |
236 |
237 |
238 | GridViewDemoViewController
239 | UIViewController
240 |
241 | IBProjectSource
242 | GridViewDemoViewController.h
243 |
244 |
245 |
246 |
247 | YES
248 |
249 | NSObject
250 |
251 | IBFrameworkSource
252 | Foundation.framework/Headers/NSError.h
253 |
254 |
255 |
256 | NSObject
257 |
258 | IBFrameworkSource
259 | Foundation.framework/Headers/NSFileManager.h
260 |
261 |
262 |
263 | NSObject
264 |
265 | IBFrameworkSource
266 | Foundation.framework/Headers/NSKeyValueCoding.h
267 |
268 |
269 |
270 | NSObject
271 |
272 | IBFrameworkSource
273 | Foundation.framework/Headers/NSKeyValueObserving.h
274 |
275 |
276 |
277 | NSObject
278 |
279 | IBFrameworkSource
280 | Foundation.framework/Headers/NSKeyedArchiver.h
281 |
282 |
283 |
284 | NSObject
285 |
286 | IBFrameworkSource
287 | Foundation.framework/Headers/NSObject.h
288 |
289 |
290 |
291 | NSObject
292 |
293 | IBFrameworkSource
294 | Foundation.framework/Headers/NSRunLoop.h
295 |
296 |
297 |
298 | NSObject
299 |
300 | IBFrameworkSource
301 | Foundation.framework/Headers/NSThread.h
302 |
303 |
304 |
305 | NSObject
306 |
307 | IBFrameworkSource
308 | Foundation.framework/Headers/NSURL.h
309 |
310 |
311 |
312 | NSObject
313 |
314 | IBFrameworkSource
315 | Foundation.framework/Headers/NSURLConnection.h
316 |
317 |
318 |
319 | NSObject
320 |
321 | IBFrameworkSource
322 | UIKit.framework/Headers/UIAccessibility.h
323 |
324 |
325 |
326 | NSObject
327 |
328 | IBFrameworkSource
329 | UIKit.framework/Headers/UINibLoading.h
330 |
331 |
332 |
333 | NSObject
334 |
335 | IBFrameworkSource
336 | UIKit.framework/Headers/UIResponder.h
337 |
338 |
339 |
340 | UIApplication
341 | UIResponder
342 |
343 | IBFrameworkSource
344 | UIKit.framework/Headers/UIApplication.h
345 |
346 |
347 |
348 | UIResponder
349 | NSObject
350 |
351 |
352 |
353 | UISearchBar
354 | UIView
355 |
356 | IBFrameworkSource
357 | UIKit.framework/Headers/UISearchBar.h
358 |
359 |
360 |
361 | UISearchDisplayController
362 | NSObject
363 |
364 | IBFrameworkSource
365 | UIKit.framework/Headers/UISearchDisplayController.h
366 |
367 |
368 |
369 | UIView
370 |
371 | IBFrameworkSource
372 | UIKit.framework/Headers/UITextField.h
373 |
374 |
375 |
376 | UIView
377 | UIResponder
378 |
379 | IBFrameworkSource
380 | UIKit.framework/Headers/UIView.h
381 |
382 |
383 |
384 | UIViewController
385 |
386 | IBFrameworkSource
387 | UIKit.framework/Headers/UINavigationController.h
388 |
389 |
390 |
391 | UIViewController
392 |
393 | IBFrameworkSource
394 | UIKit.framework/Headers/UIPopoverController.h
395 |
396 |
397 |
398 | UIViewController
399 |
400 | IBFrameworkSource
401 | UIKit.framework/Headers/UISplitViewController.h
402 |
403 |
404 |
405 | UIViewController
406 |
407 | IBFrameworkSource
408 | UIKit.framework/Headers/UITabBarController.h
409 |
410 |
411 |
412 | UIViewController
413 | UIResponder
414 |
415 | IBFrameworkSource
416 | UIKit.framework/Headers/UIViewController.h
417 |
418 |
419 |
420 | UIWindow
421 | UIView
422 |
423 | IBFrameworkSource
424 | UIKit.framework/Headers/UIWindow.h
425 |
426 |
427 |
428 |
429 | 0
430 | IBCocoaTouchFramework
431 |
432 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS
433 |
434 |
435 |
436 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3
437 |
438 |
439 | YES
440 | GridViewDemo.xcodeproj
441 | 3
442 | 112
443 |
444 |
445 |
--------------------------------------------------------------------------------
/Examples/GridViewDemo/GridViewDemo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // GridViewDemo
4 | //
5 | // Created by Kolin Krewinkel on 7.25.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | int main(int argc, char *argv[])
12 | {
13 | @autoreleasepool {
14 | int retVal = UIApplicationMain(argc, argv, nil, nil);
15 | return retVal;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/KKGridView.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'KKGridView'
3 | s.version = '0.6.8.2'
4 | s.license = 'MIT'
5 | s.platform = :ios
6 | s.summary = 'Gridview for iOS.'
7 | s.homepage = 'https://github.com/kolinkrewinkel/KKGridView'
8 | s.authors = { 'Kolin Krewinkel' => 'kolin@kolinkrewinkel.com',
9 | 'Giulio Petek' => 'gi-lo@touch-mania.com',
10 | 'Jonathan Sterling' => 'jonsterling@me.com',
11 | 'Kyle Hickinson' => 'kyle.hickinson@gmail.com',
12 | 'Matthias Tretter' => 'matthias.tretter@gmail.com',
13 | 'Peter Steinberger' => 'me@petersteinberger.com' }
14 |
15 | s.source = { :git => 'https://github.com/kolinkrewinkel/KKGridView.git', :tag => '0.6.8.2' }
16 |
17 | s.source_files = 'KKGridView'
18 | s.clean_paths = 'Examples', 'KKGridView.xcodeproj', 'Resources'
19 | s.library = 'stdc++'
20 | s.framework = 'QuartzCore'
21 | s.requires_arc = true
22 | end
23 |
--------------------------------------------------------------------------------
/KKGridView.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1A0BEC7613DDF862003C2632 /* KKIndexPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0BEC7413DDF862003C2632 /* KKIndexPath.h */; settings = {ATTRIBUTES = (Public, ); }; };
11 | 1A0BEC7713DDF862003C2632 /* KKIndexPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A0BEC7513DDF862003C2632 /* KKIndexPath.m */; };
12 | 1A32AD8113DCDF1D00E8CC7C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A32AD7F13DCDF1D00E8CC7C /* CoreGraphics.framework */; };
13 | 1A32AD8213DCDF1D00E8CC7C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A32AD8013DCDF1D00E8CC7C /* UIKit.framework */; };
14 | 1A32AD8513DCDFB200E8CC7C /* KKGridView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A32AD8313DCDFB200E8CC7C /* KKGridView.h */; settings = {ATTRIBUTES = (Public, ); }; };
15 | 1A32AD8613DCDFB200E8CC7C /* KKGridView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A32AD8413DCDFB200E8CC7C /* KKGridView.m */; };
16 | 1A32AD8913DCDFC200E8CC7C /* KKGridViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A32AD8713DCDFC200E8CC7C /* KKGridViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
17 | 1A32AD8A13DCDFC200E8CC7C /* KKGridViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A32AD8813DCDFC200E8CC7C /* KKGridViewCell.m */; };
18 | 1A3F1B7013E34A62006747A3 /* KKGridViewUpdateStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3F1B6E13E34A61006747A3 /* KKGridViewUpdateStack.h */; };
19 | 1A3F1B7113E34A62006747A3 /* KKGridViewUpdateStack.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A3F1B6F13E34A61006747A3 /* KKGridViewUpdateStack.m */; };
20 | 1A3F1B7413E34CF8006747A3 /* KKGridViewUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3F1B7213E34CF8006747A3 /* KKGridViewUpdate.h */; };
21 | 1A3F1B7513E34CF8006747A3 /* KKGridViewUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A3F1B7313E34CF8006747A3 /* KKGridViewUpdate.m */; };
22 | 1A5F356713DD02CD00A38A3E /* Definitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5F356613DD02CD00A38A3E /* Definitions.h */; settings = {ATTRIBUTES = (Public, ); }; };
23 | 1A61BE1313DCAF1F00AB4243 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A61BE1213DCAF1F00AB4243 /* Foundation.framework */; };
24 | 1A72A9751453AE42002546F8 /* KKGridViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A72A9731453AE42002546F8 /* KKGridViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
25 | 1A72A9761453AE42002546F8 /* KKGridViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A72A9741453AE42002546F8 /* KKGridViewController.m */; };
26 | 1AD5397A13DF7A060071EFDC /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AD5397913DF7A060071EFDC /* CoreFoundation.framework */; };
27 | 1AD5397C13DF7E690071EFDC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AD5397B13DF7E690071EFDC /* QuartzCore.framework */; };
28 | 330A4C62154A5FE9002868AB /* KKGridViewSectionLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 330A4C60154A5FE9002868AB /* KKGridViewSectionLabel.h */; };
29 | 330A4C63154A5FE9002868AB /* KKGridViewSectionLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 330A4C61154A5FE9002868AB /* KKGridViewSectionLabel.m */; };
30 | F42166A614A3A610004E0C32 /* KKGridViewIndexView.h in Headers */ = {isa = PBXBuildFile; fileRef = F42166A414A3A610004E0C32 /* KKGridViewIndexView.h */; };
31 | F42166A714A3A610004E0C32 /* KKGridViewIndexView.m in Sources */ = {isa = PBXBuildFile; fileRef = F42166A514A3A610004E0C32 /* KKGridViewIndexView.m */; };
32 | FC368B40149B483900B92E57 /* KKBlocksDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = FC368B3E149B483900B92E57 /* KKBlocksDelegate.h */; };
33 | FC368B41149B483900B92E57 /* KKBlocksDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FC368B3F149B483900B92E57 /* KKBlocksDelegate.m */; };
34 | FC53DF8313E629FE000767B1 /* KKGridViewSectionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FC53DF8113E629FE000767B1 /* KKGridViewSectionInfo.h */; };
35 | FC53DF8413E629FE000767B1 /* KKGridViewSectionInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = FC53DF8213E629FE000767B1 /* KKGridViewSectionInfo.m */; };
36 | /* End PBXBuildFile section */
37 |
38 | /* Begin PBXFileReference section */
39 | 1A0BEC7413DDF862003C2632 /* KKIndexPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKIndexPath.h; sourceTree = ""; };
40 | 1A0BEC7513DDF862003C2632 /* KKIndexPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KKIndexPath.m; sourceTree = ""; };
41 | 1A32AD7F13DCDF1D00E8CC7C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
42 | 1A32AD8013DCDF1D00E8CC7C /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
43 | 1A32AD8313DCDFB200E8CC7C /* KKGridView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKGridView.h; sourceTree = ""; };
44 | 1A32AD8413DCDFB200E8CC7C /* KKGridView.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = KKGridView.m; sourceTree = ""; tabWidth = 4; };
45 | 1A32AD8713DCDFC200E8CC7C /* KKGridViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKGridViewCell.h; sourceTree = ""; };
46 | 1A32AD8813DCDFC200E8CC7C /* KKGridViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KKGridViewCell.m; sourceTree = ""; };
47 | 1A3F1B6E13E34A61006747A3 /* KKGridViewUpdateStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKGridViewUpdateStack.h; sourceTree = ""; };
48 | 1A3F1B6F13E34A61006747A3 /* KKGridViewUpdateStack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KKGridViewUpdateStack.m; sourceTree = ""; };
49 | 1A3F1B7213E34CF8006747A3 /* KKGridViewUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKGridViewUpdate.h; sourceTree = ""; };
50 | 1A3F1B7313E34CF8006747A3 /* KKGridViewUpdate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KKGridViewUpdate.m; sourceTree = ""; };
51 | 1A5F356613DD02CD00A38A3E /* Definitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Definitions.h; sourceTree = ""; };
52 | 1A61BE0F13DCAF1F00AB4243 /* libKKGridView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKKGridView.a; sourceTree = BUILT_PRODUCTS_DIR; };
53 | 1A61BE1213DCAF1F00AB4243 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
54 | 1A61BE1613DCAF1F00AB4243 /* KKGridView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KKGridView-Prefix.pch"; sourceTree = ""; };
55 | 1A72A9731453AE42002546F8 /* KKGridViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKGridViewController.h; sourceTree = ""; };
56 | 1A72A9741453AE42002546F8 /* KKGridViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KKGridViewController.m; sourceTree = ""; };
57 | 1A7DF7041454E543000372DA /* Resources-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Resources-Info.plist"; sourceTree = ""; };
58 | 1A7DF7061454E543000372DA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
59 | 1A7DF7081454E543000372DA /* Resources-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Resources-Prefix.pch"; sourceTree = ""; };
60 | 1AD5397913DF7A060071EFDC /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
61 | 1AD5397B13DF7E690071EFDC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
62 | 330A4C60154A5FE9002868AB /* KKGridViewSectionLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKGridViewSectionLabel.h; sourceTree = ""; };
63 | 330A4C61154A5FE9002868AB /* KKGridViewSectionLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KKGridViewSectionLabel.m; sourceTree = ""; };
64 | F42166A414A3A610004E0C32 /* KKGridViewIndexView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKGridViewIndexView.h; sourceTree = ""; };
65 | F42166A514A3A610004E0C32 /* KKGridViewIndexView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KKGridViewIndexView.m; sourceTree = ""; };
66 | FC368B3E149B483900B92E57 /* KKBlocksDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKBlocksDelegate.h; sourceTree = ""; };
67 | FC368B3F149B483900B92E57 /* KKBlocksDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KKBlocksDelegate.m; sourceTree = ""; };
68 | FC53DF8113E629FE000767B1 /* KKGridViewSectionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KKGridViewSectionInfo.h; sourceTree = ""; };
69 | FC53DF8213E629FE000767B1 /* KKGridViewSectionInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KKGridViewSectionInfo.m; sourceTree = ""; };
70 | /* End PBXFileReference section */
71 |
72 | /* Begin PBXFrameworksBuildPhase section */
73 | 1A61BE0C13DCAF1F00AB4243 /* Frameworks */ = {
74 | isa = PBXFrameworksBuildPhase;
75 | buildActionMask = 2147483647;
76 | files = (
77 | 1AD5397A13DF7A060071EFDC /* CoreFoundation.framework in Frameworks */,
78 | 1A32AD8113DCDF1D00E8CC7C /* CoreGraphics.framework in Frameworks */,
79 | 1A61BE1313DCAF1F00AB4243 /* Foundation.framework in Frameworks */,
80 | 1AD5397C13DF7E690071EFDC /* QuartzCore.framework in Frameworks */,
81 | 1A32AD8213DCDF1D00E8CC7C /* UIKit.framework in Frameworks */,
82 | );
83 | runOnlyForDeploymentPostprocessing = 0;
84 | };
85 | /* End PBXFrameworksBuildPhase section */
86 |
87 | /* Begin PBXGroup section */
88 | 1A61BE0413DCAF1F00AB4243 = {
89 | isa = PBXGroup;
90 | children = (
91 | 1A61BE1413DCAF1F00AB4243 /* KKGridView */,
92 | 1A7DF7021454E543000372DA /* Resources */,
93 | 1A61BE1113DCAF1F00AB4243 /* Frameworks */,
94 | 1A61BE1013DCAF1F00AB4243 /* Products */,
95 | );
96 | indentWidth = 4;
97 | sourceTree = "";
98 | tabWidth = 4;
99 | };
100 | 1A61BE1013DCAF1F00AB4243 /* Products */ = {
101 | isa = PBXGroup;
102 | children = (
103 | 1A61BE0F13DCAF1F00AB4243 /* libKKGridView.a */,
104 | );
105 | name = Products;
106 | sourceTree = "";
107 | };
108 | 1A61BE1113DCAF1F00AB4243 /* Frameworks */ = {
109 | isa = PBXGroup;
110 | children = (
111 | 1AD5397913DF7A060071EFDC /* CoreFoundation.framework */,
112 | 1A32AD7F13DCDF1D00E8CC7C /* CoreGraphics.framework */,
113 | 1A61BE1213DCAF1F00AB4243 /* Foundation.framework */,
114 | 1AD5397B13DF7E690071EFDC /* QuartzCore.framework */,
115 | 1A32AD8013DCDF1D00E8CC7C /* UIKit.framework */,
116 | );
117 | name = Frameworks;
118 | sourceTree = "";
119 | };
120 | 1A61BE1413DCAF1F00AB4243 /* KKGridView */ = {
121 | isa = PBXGroup;
122 | children = (
123 | 1A32AD8313DCDFB200E8CC7C /* KKGridView.h */,
124 | 1A32AD8413DCDFB200E8CC7C /* KKGridView.m */,
125 | 1A32AD8713DCDFC200E8CC7C /* KKGridViewCell.h */,
126 | 1A32AD8813DCDFC200E8CC7C /* KKGridViewCell.m */,
127 | 1A0BEC7413DDF862003C2632 /* KKIndexPath.h */,
128 | 1A0BEC7513DDF862003C2632 /* KKIndexPath.m */,
129 | FC368B3E149B483900B92E57 /* KKBlocksDelegate.h */,
130 | FC368B3F149B483900B92E57 /* KKBlocksDelegate.m */,
131 | F42166A414A3A610004E0C32 /* KKGridViewIndexView.h */,
132 | F42166A514A3A610004E0C32 /* KKGridViewIndexView.m */,
133 | 1A3F1B7213E34CF8006747A3 /* KKGridViewUpdate.h */,
134 | 1A3F1B7313E34CF8006747A3 /* KKGridViewUpdate.m */,
135 | 1A3F1B6E13E34A61006747A3 /* KKGridViewUpdateStack.h */,
136 | 1A3F1B6F13E34A61006747A3 /* KKGridViewUpdateStack.m */,
137 | FC53DF8113E629FE000767B1 /* KKGridViewSectionInfo.h */,
138 | FC53DF8213E629FE000767B1 /* KKGridViewSectionInfo.m */,
139 | 330A4C60154A5FE9002868AB /* KKGridViewSectionLabel.h */,
140 | 330A4C61154A5FE9002868AB /* KKGridViewSectionLabel.m */,
141 | 1A72A9731453AE42002546F8 /* KKGridViewController.h */,
142 | 1A72A9741453AE42002546F8 /* KKGridViewController.m */,
143 | 1A61BE1513DCAF1F00AB4243 /* Supporting Files */,
144 | );
145 | path = KKGridView;
146 | sourceTree = "";
147 | };
148 | 1A61BE1513DCAF1F00AB4243 /* Supporting Files */ = {
149 | isa = PBXGroup;
150 | children = (
151 | 1A5F356613DD02CD00A38A3E /* Definitions.h */,
152 | 1A61BE1613DCAF1F00AB4243 /* KKGridView-Prefix.pch */,
153 | );
154 | name = "Supporting Files";
155 | sourceTree = "";
156 | };
157 | 1A7DF7021454E543000372DA /* Resources */ = {
158 | isa = PBXGroup;
159 | children = (
160 | 1A7DF7031454E543000372DA /* Supporting Files */,
161 | );
162 | path = Resources;
163 | sourceTree = "";
164 | };
165 | 1A7DF7031454E543000372DA /* Supporting Files */ = {
166 | isa = PBXGroup;
167 | children = (
168 | 1A7DF7041454E543000372DA /* Resources-Info.plist */,
169 | 1A7DF7051454E543000372DA /* InfoPlist.strings */,
170 | 1A7DF7081454E543000372DA /* Resources-Prefix.pch */,
171 | );
172 | name = "Supporting Files";
173 | sourceTree = "";
174 | };
175 | /* End PBXGroup section */
176 |
177 | /* Begin PBXHeadersBuildPhase section */
178 | 1A61BE0D13DCAF1F00AB4243 /* Headers */ = {
179 | isa = PBXHeadersBuildPhase;
180 | buildActionMask = 2147483647;
181 | files = (
182 | 1A5F356713DD02CD00A38A3E /* Definitions.h in Headers */,
183 | 1A32AD8513DCDFB200E8CC7C /* KKGridView.h in Headers */,
184 | 1A32AD8913DCDFC200E8CC7C /* KKGridViewCell.h in Headers */,
185 | 1A72A9751453AE42002546F8 /* KKGridViewController.h in Headers */,
186 | 1A0BEC7613DDF862003C2632 /* KKIndexPath.h in Headers */,
187 | 1A3F1B7413E34CF8006747A3 /* KKGridViewUpdate.h in Headers */,
188 | 1A3F1B7013E34A62006747A3 /* KKGridViewUpdateStack.h in Headers */,
189 | FC53DF8313E629FE000767B1 /* KKGridViewSectionInfo.h in Headers */,
190 | FC368B40149B483900B92E57 /* KKBlocksDelegate.h in Headers */,
191 | F42166A614A3A610004E0C32 /* KKGridViewIndexView.h in Headers */,
192 | 330A4C62154A5FE9002868AB /* KKGridViewSectionLabel.h in Headers */,
193 | );
194 | runOnlyForDeploymentPostprocessing = 0;
195 | };
196 | /* End PBXHeadersBuildPhase section */
197 |
198 | /* Begin PBXNativeTarget section */
199 | 1A61BE0E13DCAF1F00AB4243 /* KKGridView */ = {
200 | isa = PBXNativeTarget;
201 | buildConfigurationList = 1A61BE1C13DCAF1F00AB4243 /* Build configuration list for PBXNativeTarget "KKGridView" */;
202 | buildPhases = (
203 | 1A61BE0B13DCAF1F00AB4243 /* Sources */,
204 | 1A61BE0C13DCAF1F00AB4243 /* Frameworks */,
205 | 1A61BE0D13DCAF1F00AB4243 /* Headers */,
206 | );
207 | buildRules = (
208 | );
209 | dependencies = (
210 | );
211 | name = KKGridView;
212 | productName = KKGridView;
213 | productReference = 1A61BE0F13DCAF1F00AB4243 /* libKKGridView.a */;
214 | productType = "com.apple.product-type.library.static";
215 | };
216 | /* End PBXNativeTarget section */
217 |
218 | /* Begin PBXProject section */
219 | 1A61BE0613DCAF1F00AB4243 /* Project object */ = {
220 | isa = PBXProject;
221 | attributes = {
222 | LastUpgradeCheck = 0440;
223 | ORGANIZATIONNAME = "kxk design";
224 | };
225 | buildConfigurationList = 1A61BE0913DCAF1F00AB4243 /* Build configuration list for PBXProject "KKGridView" */;
226 | compatibilityVersion = "Xcode 3.2";
227 | developmentRegion = English;
228 | hasScannedForEncodings = 0;
229 | knownRegions = (
230 | en,
231 | );
232 | mainGroup = 1A61BE0413DCAF1F00AB4243;
233 | productRefGroup = 1A61BE1013DCAF1F00AB4243 /* Products */;
234 | projectDirPath = "";
235 | projectRoot = "";
236 | targets = (
237 | 1A61BE0E13DCAF1F00AB4243 /* KKGridView */,
238 | );
239 | };
240 | /* End PBXProject section */
241 |
242 | /* Begin PBXSourcesBuildPhase section */
243 | 1A61BE0B13DCAF1F00AB4243 /* Sources */ = {
244 | isa = PBXSourcesBuildPhase;
245 | buildActionMask = 2147483647;
246 | files = (
247 | 1A32AD8613DCDFB200E8CC7C /* KKGridView.m in Sources */,
248 | 1A32AD8A13DCDFC200E8CC7C /* KKGridViewCell.m in Sources */,
249 | 1A0BEC7713DDF862003C2632 /* KKIndexPath.m in Sources */,
250 | 1A3F1B7113E34A62006747A3 /* KKGridViewUpdateStack.m in Sources */,
251 | 1A3F1B7513E34CF8006747A3 /* KKGridViewUpdate.m in Sources */,
252 | FC53DF8413E629FE000767B1 /* KKGridViewSectionInfo.m in Sources */,
253 | 1A72A9761453AE42002546F8 /* KKGridViewController.m in Sources */,
254 | FC368B41149B483900B92E57 /* KKBlocksDelegate.m in Sources */,
255 | F42166A714A3A610004E0C32 /* KKGridViewIndexView.m in Sources */,
256 | 330A4C63154A5FE9002868AB /* KKGridViewSectionLabel.m in Sources */,
257 | );
258 | runOnlyForDeploymentPostprocessing = 0;
259 | };
260 | /* End PBXSourcesBuildPhase section */
261 |
262 | /* Begin PBXVariantGroup section */
263 | 1A7DF7051454E543000372DA /* InfoPlist.strings */ = {
264 | isa = PBXVariantGroup;
265 | children = (
266 | 1A7DF7061454E543000372DA /* en */,
267 | );
268 | name = InfoPlist.strings;
269 | sourceTree = "";
270 | };
271 | /* End PBXVariantGroup section */
272 |
273 | /* Begin XCBuildConfiguration section */
274 | 1A61BE1A13DCAF1F00AB4243 /* Debug */ = {
275 | isa = XCBuildConfiguration;
276 | buildSettings = {
277 | ALWAYS_SEARCH_USER_PATHS = NO;
278 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
279 | COPY_PHASE_STRIP = NO;
280 | GCC_C_LANGUAGE_STANDARD = gnu99;
281 | GCC_DYNAMIC_NO_PIC = NO;
282 | GCC_OPTIMIZATION_LEVEL = 0;
283 | GCC_PREPROCESSOR_DEFINITIONS = (
284 | "DEBUG=1",
285 | "$(inherited)",
286 | );
287 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
288 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
289 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
290 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
291 | GCC_WARN_UNUSED_VARIABLE = YES;
292 | IPHONEOS_DEPLOYMENT_TARGET = 4.0;
293 | SDKROOT = iphoneos;
294 | };
295 | name = Debug;
296 | };
297 | 1A61BE1B13DCAF1F00AB4243 /* Release */ = {
298 | isa = XCBuildConfiguration;
299 | buildSettings = {
300 | ALWAYS_SEARCH_USER_PATHS = NO;
301 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
302 | COPY_PHASE_STRIP = YES;
303 | GCC_C_LANGUAGE_STANDARD = gnu99;
304 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
305 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
306 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
307 | GCC_WARN_UNUSED_VARIABLE = YES;
308 | IPHONEOS_DEPLOYMENT_TARGET = 4.0;
309 | SDKROOT = iphoneos;
310 | VALIDATE_PRODUCT = YES;
311 | };
312 | name = Release;
313 | };
314 | 1A61BE1D13DCAF1F00AB4243 /* Debug */ = {
315 | isa = XCBuildConfiguration;
316 | buildSettings = {
317 | ARCHS = (
318 | "$(ARCHS_STANDARD_32_BIT)",
319 | armv6,
320 | );
321 | CLANG_ARC_MIGRATION = donothing;
322 | CLANG_ENABLE_OBJC_ARC = YES;
323 | CLANG_WARN_OBJCPP_ARC_ABI = YES;
324 | GCC_OPTIMIZATION_LEVEL = 0;
325 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
326 | GCC_PREFIX_HEADER = "KKGridView/KKGridView-Prefix.pch";
327 | GCC_THUMB_SUPPORT = NO;
328 | INSTALL_PATH = "/../BuildProductsPath/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/";
329 | IPHONEOS_DEPLOYMENT_TARGET = 4.0;
330 | OTHER_LDFLAGS = (
331 | "-all_load",
332 | "-ObjC",
333 | );
334 | PRODUCT_NAME = "$(TARGET_NAME)";
335 | PUBLIC_HEADERS_FOLDER_PATH = "include/$(PROJECT_NAME)";
336 | RUN_CLANG_STATIC_ANALYZER = NO;
337 | SDKROOT = iphoneos;
338 | SKIP_INSTALL = NO;
339 | };
340 | name = Debug;
341 | };
342 | 1A61BE1E13DCAF1F00AB4243 /* Release */ = {
343 | isa = XCBuildConfiguration;
344 | buildSettings = {
345 | ARCHS = (
346 | "$(ARCHS_STANDARD_32_BIT)",
347 | armv6,
348 | );
349 | CLANG_ARC_MIGRATION = donothing;
350 | CLANG_ENABLE_OBJC_ARC = YES;
351 | CLANG_WARN_OBJCPP_ARC_ABI = YES;
352 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
353 | GCC_PREFIX_HEADER = "KKGridView/KKGridView-Prefix.pch";
354 | GCC_THUMB_SUPPORT = NO;
355 | INSTALL_PATH = "/../BuildProductsPath/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/";
356 | IPHONEOS_DEPLOYMENT_TARGET = 4.0;
357 | OTHER_LDFLAGS = (
358 | "-all_load",
359 | "-ObjC",
360 | );
361 | PRODUCT_NAME = "$(TARGET_NAME)";
362 | PUBLIC_HEADERS_FOLDER_PATH = "include/$(PROJECT_NAME)";
363 | RUN_CLANG_STATIC_ANALYZER = YES;
364 | SDKROOT = iphoneos;
365 | SKIP_INSTALL = NO;
366 | };
367 | name = Release;
368 | };
369 | /* End XCBuildConfiguration section */
370 |
371 | /* Begin XCConfigurationList section */
372 | 1A61BE0913DCAF1F00AB4243 /* Build configuration list for PBXProject "KKGridView" */ = {
373 | isa = XCConfigurationList;
374 | buildConfigurations = (
375 | 1A61BE1A13DCAF1F00AB4243 /* Debug */,
376 | 1A61BE1B13DCAF1F00AB4243 /* Release */,
377 | );
378 | defaultConfigurationIsVisible = 0;
379 | defaultConfigurationName = Release;
380 | };
381 | 1A61BE1C13DCAF1F00AB4243 /* Build configuration list for PBXNativeTarget "KKGridView" */ = {
382 | isa = XCConfigurationList;
383 | buildConfigurations = (
384 | 1A61BE1D13DCAF1F00AB4243 /* Debug */,
385 | 1A61BE1E13DCAF1F00AB4243 /* Release */,
386 | );
387 | defaultConfigurationIsVisible = 0;
388 | defaultConfigurationName = Release;
389 | };
390 | /* End XCConfigurationList section */
391 | };
392 | rootObject = 1A61BE0613DCAF1F00AB4243 /* Project object */;
393 | }
394 |
--------------------------------------------------------------------------------
/KKGridView.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/KKGridView/Definitions.h:
--------------------------------------------------------------------------------
1 | //
2 | // Definitions.h
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 7.24.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // Defines
12 |
13 | #define KKGridViewDefaultAnimationDuration 0.25
14 |
15 | // Macros
16 |
17 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000
18 | #define kk_weak weak
19 | #define __kk_weak __weak
20 | #else
21 | #define kk_weak unsafe_unretained
22 | #define __kk_weak __unsafe_unretained
23 | #endif
24 |
25 | #if !defined(KKInline)
26 | #define KKInline static __inline__ __attribute__((always_inline))
27 | #endif
28 |
29 | KKInline BOOL KKCGRectIntersectsRectVertically(CGRect rect1, CGRect rect2)
30 | {
31 | return (CGRectGetMinY(rect2) < CGRectGetMaxY(rect1)) && (CGRectGetMaxY(rect2) > CGRectGetMinY(rect1));
32 | }
33 |
34 | KKInline BOOL KKCGRectIntersectsRectVerticallyWithPositiveNegativeMargin(CGRect rect1, CGRect rect2, CGFloat margin)
35 | {
36 | return (CGRectGetMinY(rect2) - margin < CGRectGetMaxY(rect1)) && (CGRectGetMaxY(rect2) + margin > CGRectGetMinY(rect1));
37 | }
38 |
39 |
40 |
--------------------------------------------------------------------------------
/KKGridView/KKBlocksDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKBlocksDelegate.h
3 | // KKGridView
4 | //
5 | // Created by Jonathan Sterling on 12/16/11.
6 | // Copyright (c) 2011 kxk design. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // Use KKBlocksDelegate if you prefer blocks to implementing protocols.
12 | // You need to maintain ownership of this object, since the dataSource/delegate
13 | // references are weak.
14 |
15 | @interface KKBlocksDelegate : NSObject
16 | @property (copy) KKGridViewCell *(^cell)(KKGridView *gridView, KKIndexPath *indexPath);
17 | @property (copy) NSUInteger (^numberOfSections)(KKGridView *gridView);
18 | @property (copy) NSUInteger (^numberOfItems)(KKGridView *gridView, NSUInteger section);
19 | @property (copy) CGFloat (^heightForHeader)(KKGridView *gridView, NSUInteger section);
20 | @property (copy) CGFloat (^heightForFooter)(KKGridView *gridView, NSUInteger section);
21 | @property (copy) NSString *(^titleForHeader)(KKGridView *gridView, NSUInteger section);
22 | @property (copy) NSString *(^titleForFooter)(KKGridView *gridView, NSUInteger section);
23 | @property (copy) UIView *(^viewForHeader)(KKGridView *gridView, NSUInteger section);
24 | @property (copy) UIView *(^viewForFooter)(KKGridView *gridView, NSUInteger section);
25 |
26 | @property (copy) void (^didSelectItem)(KKGridView *gridView, KKIndexPath *indexPath);
27 | @property (copy) void (^didDeselectItem)(KKGridView *gridView, KKIndexPath *indexPath);
28 | @property (copy) KKIndexPath *(^willSelectItem)(KKGridView *gridView, KKIndexPath *indexPath);
29 | @property (copy) KKIndexPath *(^willDeselectItem)(KKGridView *gridView, KKIndexPath *indexPath);
30 | @property (copy) void (^willDisplayCell)(KKGridView *gridView, KKGridViewCell *cell, KKIndexPath *indexPath);
31 | @end
32 |
--------------------------------------------------------------------------------
/KKGridView/KKBlocksDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKBlocksDelegate.m
3 | // KKGridView
4 | //
5 | // Created by Jonathan Sterling on 12/16/11.
6 | // Copyright (c) 2011 kxk design. All rights reserved.
7 | //
8 |
9 | #import "KKBlocksDelegate.h"
10 |
11 | @implementation KKBlocksDelegate
12 | @synthesize cell = _cell;
13 | @synthesize numberOfSections = _numberOfSections;
14 | @synthesize numberOfItems = _numberOfItems;
15 | @synthesize heightForHeader = _heightForHeader;
16 | @synthesize heightForFooter = _heightForFooter;
17 | @synthesize titleForHeader = _titleForHeader;
18 | @synthesize titleForFooter = _titleForFooter;
19 | @synthesize viewForHeader = _viewForHeader;
20 | @synthesize viewForFooter = _viewForFooter;
21 |
22 | @synthesize didSelectItem = _didSelectItem;
23 | @synthesize didDeselectItem = _didDeselectItem;
24 | @synthesize willSelectItem = _willSelectItem;
25 | @synthesize willDeselectItem = _willDeselectItem;
26 | @synthesize willDisplayCell = _willDisplayCell;
27 |
28 | #pragma mark - KKGridViewDataSource
29 |
30 | - (NSUInteger)gridView:(KKGridView *)gridView numberOfItemsInSection:(NSUInteger)section
31 | {
32 | return _numberOfItems ? _numberOfItems(gridView,section) : 0;
33 | }
34 |
35 | - (KKGridViewCell *)gridView:(KKGridView *)gridView cellForItemAtIndexPath:(KKIndexPath *)indexPath
36 | {
37 | return _cell ? _cell(gridView,indexPath) : [KKGridViewCell cellForGridView:gridView];
38 | }
39 |
40 | - (NSUInteger)numberOfSectionsInGridView:(KKGridView *)gridView
41 | {
42 | return _numberOfSections ? _numberOfSections(gridView) : 1;
43 | }
44 |
45 | - (NSString *)gridView:(KKGridView *)gridView titleForHeaderInSection:(NSUInteger)section
46 | {
47 | return _titleForHeader ? _titleForFooter(gridView,section) : @"";
48 | }
49 |
50 | - (NSString *)gridView:(KKGridView *)gridView titleForFooterInSection:(NSUInteger)section
51 | {
52 | return _titleForFooter ? _titleForFooter(gridView,section) : @"";
53 | }
54 |
55 | - (CGFloat)gridView:(KKGridView *)gridView heightForHeaderInSection:(NSUInteger)section
56 | {
57 | return _heightForHeader ? _heightForHeader(gridView,section) : 25.0;
58 | }
59 |
60 | - (CGFloat)gridView:(KKGridView *)gridView heightForFooterInSection:(NSUInteger)section
61 | {
62 | return _heightForFooter ? _heightForFooter(gridView,section) : 25.0;
63 | }
64 |
65 | - (UIView *)gridView:(KKGridView *)gridView viewForHeaderInSection:(NSUInteger)section
66 | {
67 | return _viewForHeader ? _viewForHeader(gridView,section) : nil;
68 | }
69 |
70 | - (UIView *)gridView:(KKGridView *)gridView viewForFooterInSection:(NSUInteger)section
71 | {
72 | return _viewForFooter ? _viewForFooter(gridView,section) : nil;
73 | }
74 |
75 | #pragma mark - KKGridViewDelegate
76 |
77 | - (void)gridView:(KKGridView *)gridView didSelectItemAtIndexPath:(KKIndexPath *)indexPath
78 | {
79 | if (_didSelectItem)
80 | _didSelectItem(gridView,indexPath);
81 | }
82 |
83 | - (void)gridView:(KKGridView *)gridView didDeselectItemAtIndexPath:(KKIndexPath *)indexPath
84 | {
85 | if (_didDeselectItem)
86 | _didDeselectItem(gridView,indexPath);
87 | }
88 |
89 | - (KKIndexPath *)gridView:(KKGridView *)gridView willSelectItemAtIndexPath:(KKIndexPath *)indexPath
90 | {
91 | return _willSelectItem ? _willSelectItem(gridView,indexPath) : indexPath;
92 | }
93 |
94 | - (KKIndexPath *)gridView:(KKGridView *)gridView willDeselectItemAtIndexPath:(KKIndexPath *)indexPath
95 | {
96 | return _willDeselectItem ? _willDeselectItem(gridView,indexPath) : indexPath;
97 | }
98 |
99 | - (void)gridView:(KKGridView *)gridView willDisplayCell:(KKGridViewCell *)cell atIndexPath:(KKIndexPath *)indexPath
100 | {
101 | if (_willDisplayCell)
102 | _willDisplayCell(gridView,cell,indexPath);
103 | }
104 |
105 | @end
106 |
--------------------------------------------------------------------------------
/KKGridView/KKGridView-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'KKGridView' target in the 'KKGridView' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #import
8 | #import
9 | #import
10 | #import
11 | #import
12 | #endif
13 |
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UISectionListHeaderBackground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UISectionListHeaderBackground.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UISectionListHeaderBackground@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UISectionListHeaderBackground@2x.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UISectionListHeaderBackgroundOpaque.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UISectionListHeaderBackgroundOpaque.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UISectionListHeaderBackgroundOpaque@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UISectionListHeaderBackgroundOpaque@2x.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UIUnreadIndicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UIUnreadIndicator.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UIUnreadIndicator@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UIUnreadIndicator@2x.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UIUnreadIndicatorPartial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UIUnreadIndicatorPartial.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UIUnreadIndicatorPartial@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UIUnreadIndicatorPartial@2x.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UIUnreadIndicatorPartialPressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UIUnreadIndicatorPartialPressed.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UIUnreadIndicatorPartialPressed@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UIUnreadIndicatorPartialPressed@2x.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UIUnreadIndicatorPressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UIUnreadIndicatorPressed.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/UIUnreadIndicatorPressed@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/UIUnreadIndicatorPressed@2x.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/failure-btn-press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/failure-btn-press.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/failure-btn-press@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/failure-btn-press@2x.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/failure-btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/failure-btn.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.bundle/failure-btn@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kolinkrewinkel/KKGridView/8dbcb6df9396e10a1442cf9994067434eb5c4385/KKGridView/KKGridView.bundle/failure-btn@2x.png
--------------------------------------------------------------------------------
/KKGridView/KKGridView.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridView.h
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 7.24.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 |
13 | typedef enum {
14 | KKGridViewAnimationFade,
15 | KKGridViewAnimationResize,
16 | KKGridViewAnimationSlideLeft,
17 | KKGridViewAnimationSlideTop,
18 | KKGridViewAnimationSlideRight,
19 | KKGridViewAnimationSlideBottom,
20 | KKGridViewAnimationExplode,
21 | KKGridViewAnimationImplode,
22 | KKGridViewAnimationNone
23 | } KKGridViewAnimation;
24 |
25 | typedef enum {
26 | KKGridViewLayoutDirectionVertical,
27 | KKGridViewLayoutDirectionHorizontal
28 | } KKGridViewLayoutDirection;
29 |
30 | typedef enum {
31 | KKGridViewScrollPositionNone,
32 | KKGridViewScrollPositionTop,
33 | KKGridViewScrollPositionMiddle,
34 | KKGridViewScrollPositionBottom
35 | } KKGridViewScrollPosition;
36 |
37 | @class KKGridView;
38 |
39 | @protocol KKGridViewDataSource
40 | @required
41 | - (NSUInteger)gridView:(KKGridView *)gridView numberOfItemsInSection:(NSUInteger)section;
42 | - (KKGridViewCell *)gridView:(KKGridView *)gridView cellForItemAtIndexPath:(KKIndexPath *)indexPath;
43 | @optional
44 | - (NSUInteger)numberOfSectionsInGridView:(KKGridView *)gridView;
45 | - (NSString *)gridView:(KKGridView *)gridView titleForHeaderInSection:(NSUInteger)section;
46 | - (NSString *)gridView:(KKGridView *)gridView titleForFooterInSection:(NSUInteger)section;
47 | - (CGFloat)gridView:(KKGridView *)gridView heightForHeaderInSection:(NSUInteger)section;
48 | - (CGFloat)gridView:(KKGridView *)gridView heightForFooterInSection:(NSUInteger)section;
49 | - (UIView *)gridView:(KKGridView *)gridView viewForHeaderInSection:(NSUInteger)section;
50 | - (UIView *)gridView:(KKGridView *)gridView viewForFooterInSection:(NSUInteger)section;
51 | - (UIView *)gridView:(KKGridView *)gridView viewForRow:(NSUInteger)row inSection:(NSUInteger)section; // a row is compromised of however many cells fit in a column of a given section
52 | - (NSArray *)sectionIndexTitlesForGridView:(KKGridView *)gridView;
53 | - (NSInteger)gridView:(KKGridView *)gridView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index;
54 | @end
55 |
56 | @protocol KKGridViewDelegate
57 | @optional
58 | - (void)gridView:(KKGridView *)gridView didSelectItemAtIndexPath:(KKIndexPath *)indexPath;
59 | - (void)gridView:(KKGridView *)gridView didDeselectItemAtIndexPath:(KKIndexPath *)indexPath;
60 | - (KKIndexPath *)gridView:(KKGridView *)gridView willSelectItemAtIndexPath:(KKIndexPath *)indexPath;
61 | - (KKIndexPath *)gridView:(KKGridView *)gridView willDeselectItemAtIndexPath:(KKIndexPath *)indexPath;
62 | - (void)gridView:(KKGridView *)gridView willDisplayCell:(KKGridViewCell *)cell atIndexPath:(KKIndexPath *)indexPath;
63 | @end
64 |
65 | @interface KKGridView : UIScrollView
66 |
67 | #pragma mark - Properties
68 |
69 | @property (nonatomic) BOOL allowsMultipleSelection;
70 | @property (nonatomic, strong) UIView *backgroundView;
71 | @property (nonatomic) CGSize cellPadding;
72 | @property (nonatomic) CGSize cellSize;
73 | @property (nonatomic, strong) UIView *gridFooterView;
74 | @property (nonatomic, strong) UIView *gridHeaderView;
75 | @property (nonatomic) KKGridViewLayoutDirection layoutDirection;
76 | @property (nonatomic, readonly) NSUInteger numberOfColumns;
77 | @property (nonatomic, readonly) NSUInteger numberOfSections;
78 | @property (nonatomic, readonly) BOOL batchUpdating;
79 |
80 | #pragma mark - Data Source and Delegate
81 | @property (nonatomic, kk_weak) IBOutlet id dataSource;
82 | @property (nonatomic, assign) IBOutlet id delegate;
83 |
84 | #pragma mark - Getters
85 |
86 | - (KKGridViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier;
87 | - (CGRect)rectForCellAtIndexPath:(KKIndexPath *)indexPath;
88 | - (NSArray *)visibleIndexPaths;
89 |
90 | - (KKIndexPath *)indexPathForCell:(KKGridViewCell *)cell;
91 | - (KKIndexPath *)indexPathForItemAtPoint:(CGPoint)point;
92 | - (NSArray *)indexPathsForItemsInRect:(CGRect)rect;
93 |
94 | #pragma mark - Reloading
95 |
96 | - (void)reloadContentSize;
97 | - (void)reloadData;
98 |
99 | #pragma mark - Editing
100 |
101 | - (void)beginUpdates;
102 | - (void)endUpdates;
103 |
104 | #pragma mark Individual Items
105 |
106 | - (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths;
107 | - (void)insertItemsAtIndexPaths:(NSArray *)indexPaths withAnimation:(KKGridViewAnimation)animation;
108 | - (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths withAnimation:(KKGridViewAnimation)animation;
109 | //- (void)moveItemAtIndexPath:(KKIndexPath *)indexPath toIndexPath:(KKIndexPath *)newIndexPath;
110 | - (void)scrollToItemAtIndexPath:(KKIndexPath *)indexPath animated:(BOOL)animated position:(KKGridViewScrollPosition)scrollPosition;
111 |
112 | #pragma mark - Unimplemented
113 |
114 | //- (void)insertSections:(NSIndexSet *)sections withItemAnimation:(KKGridViewAnimation)animation;
115 | //- (void)deleteSections:(NSIndexSet *)sections withItemAnimation:(KKGridViewAnimation)animation;
116 | //- (void)reloadSections:(NSIndexSet *)sections withAnimation:(KKGridViewAnimation)animation;
117 |
118 | #pragma mark - Selection
119 |
120 | - (void)selectItemsAtIndexPaths:(NSArray *)indexPaths animated:(BOOL)animated;
121 | - (void)deselectItemsAtIndexPaths:(NSArray *)indexPaths animated:(BOOL)animated;
122 | - (void)deselectAll: (BOOL)animated;
123 | - (NSUInteger)selectedItemCount;
124 |
125 | - (KKIndexPath *)indexPathForSelectedCell;
126 | - (NSArray *)indexPathsForSelectedCells;
127 |
128 | @end
129 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewCell.h
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 7.24.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | // For quick reference:
10 | // UITableViewCell
11 |
12 | @class KKGridView;
13 | @class KKIndexPath;
14 |
15 | typedef enum {
16 | // These aren't always respected depending on the accessory
17 | KKGridViewCellAccessoryPositionTopRight, // 1
18 | KKGridViewCellAccessoryPositionTopLeft, // 2
19 | KKGridViewCellAccessoryPositionBottomLeft, // 3
20 | KKGridViewCellAccessoryPositionBottomRight, // 4
21 | KKGridViewCellAccessoryPositionCenter
22 | } KKGridViewCellAccessoryPosition;
23 |
24 | typedef enum {
25 | KKGridViewCellAccessoryTypeNone, // Blank
26 | KKGridViewCellAccessoryTypeUnread, // Blue bullet
27 | KKGridViewCellAccessoryTypeReadPartial,
28 | KKGridViewCellAccessoryTypeNew, // New badge (ala Newsstand/Sonora)
29 | KKGridViewCellAccessoryTypeDelete, // customish deletion
30 | KKGridViewCellAccessoryTypeInfo, // Info button
31 | KKGridViewCellAccessoryTypeBadgeExclamatory, // Messages app style error
32 | KKGridViewCellAccessoryTypeBadgeNumeric, // SpringBoard numeric badge
33 | KKGridViewCellAccessoryTypeCheckmark
34 | } KKGridViewCellAccessoryType;
35 |
36 | typedef enum {
37 | KKGridViewCellAppearanceStyleAppleDefault, // Ripped from UIKit
38 | KKGridViewCellAppearanceStyleChristianDalonzo // @chrisdalonzo
39 | } KKGridViewCellAppearanceStyle;
40 |
41 | @interface KKGridViewCell : UIView
42 |
43 | #pragma mark - Class Methods
44 |
45 | + (NSString *)cellIdentifier;
46 |
47 | #pragma mark - Designated Initializer
48 |
49 | + (id)cellForGridView:(KKGridView *)gridView;
50 | - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier;
51 |
52 | #pragma mark - Properties
53 |
54 | @property (nonatomic, strong) IBOutlet UIView *backgroundView; // Underneath contentView, use this to customize backgrounds
55 | @property (nonatomic, strong) IBOutlet UIView *contentView; // Where all subviews should be.
56 | @property (nonatomic, strong) IBOutlet UIImageView *imageView;
57 | @property (nonatomic, copy) KKIndexPath *indexPath;
58 | @property (nonatomic, copy) NSString *reuseIdentifier; // For usage by KKGridView
59 | @property (nonatomic, getter = isSelected) BOOL selected;
60 | @property (nonatomic, getter = isHighlighted) BOOL highlighted;
61 | @property (nonatomic, strong) IBOutlet UIView *selectedBackgroundView; // Replaces *backgroundView when selected is YES
62 | @property (nonatomic) BOOL editing; // Editing state
63 | @property (nonatomic) KKGridViewCellAccessoryType accessoryType; // Default is none.
64 | @property (nonatomic) KKGridViewCellAccessoryPosition accessoryPosition; // Default is quadrant 1.
65 | @property (nonatomic) float highlightAlpha; // Default is 1.0f
66 |
67 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated;
68 | - (void)setEditing:(BOOL)editing animated:(BOOL)animated;
69 |
70 | #pragma mark - Subclassers
71 |
72 | - (void)prepareForReuse;
73 |
74 | @end
75 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewCell.m
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 7.24.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface KKGridViewCell ()
13 | - (UIImage *)_defaultBlueBackgroundRendition;
14 | - (void)_updateSubviewSelectionState;
15 | - (void)_layoutAccessories;
16 | @end
17 |
18 | @implementation KKGridViewCell {
19 | UIButton *_badgeView;
20 | UIColor *_userContentViewBackgroundColor;
21 | BOOL _ignoreUserContentViewBackground;
22 | }
23 |
24 | @synthesize accessoryPosition = _accessoryPosition;
25 | @synthesize accessoryType = _accessoryType;
26 | @synthesize backgroundView = _backgroundView;
27 | @synthesize contentView = _contentView;
28 | @synthesize imageView = _imageView;
29 | @synthesize editing = _editing;
30 | @synthesize indexPath = _indexPath;
31 | @synthesize reuseIdentifier = _reuseIdentifier;
32 | @synthesize selected = _selected;
33 | @synthesize highlighted = _highlighted;
34 | @synthesize selectedBackgroundView = _selectedBackgroundView;
35 | @synthesize highlightAlpha = _highlightAlpha;
36 |
37 |
38 | #pragma mark - Class Methods
39 |
40 | + (NSString *)cellIdentifier
41 | {
42 | return NSStringFromClass(self);
43 | }
44 |
45 | + (id)cellForGridView:(KKGridView *)gridView
46 | {
47 | NSString *cellID = [self cellIdentifier];
48 | KKGridViewCell *cell = (KKGridViewCell *)[gridView dequeueReusableCellWithIdentifier:cellID];
49 | if (cell == nil) {
50 | cell = [[self alloc] initWithFrame:(CGRect){ .size = gridView.cellSize } reuseIdentifier:cellID];
51 | }
52 |
53 | return cell;
54 | }
55 |
56 | #pragma mark - Designated Initializer
57 |
58 | - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier
59 | {
60 | if ((self = [super initWithFrame:frame])) {
61 | _reuseIdentifier = reuseIdentifier;
62 |
63 | _backgroundView = [[UIView alloc] initWithFrame:self.bounds];
64 | _backgroundView.backgroundColor = [UIColor whiteColor];
65 | [self addSubview:_backgroundView];
66 |
67 | _highlightAlpha = 1.0f;
68 |
69 | _contentView = [[UIView alloc] initWithFrame:self.bounds];
70 | _contentView.backgroundColor = [UIColor whiteColor];
71 | [self addSubview:_contentView];
72 | [self addSubview:_selectedBackgroundView];
73 |
74 | _imageView = [[UIImageView alloc] initWithFrame:self.bounds];
75 | _imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
76 | [self.contentView addSubview:_imageView];
77 |
78 | [_contentView addObserver:self forKeyPath:@"backgroundColor" options:NSKeyValueObservingOptionNew context:NULL];
79 | }
80 |
81 | return self;
82 | }
83 |
84 | - (void)awakeFromNib {
85 | if (!_contentView) {
86 | _contentView = [[UIView alloc] initWithFrame:self.bounds];
87 | _contentView.backgroundColor = [UIColor whiteColor];
88 | }
89 |
90 | if (!_backgroundView) {
91 | _backgroundView = [[UIView alloc] initWithFrame:self.bounds];
92 | _backgroundView.backgroundColor = [UIColor whiteColor];
93 | }
94 |
95 | [self addSubview:_backgroundView];
96 | [self addSubview:_contentView];
97 |
98 | [self bringSubviewToFront:_contentView];
99 | [self bringSubviewToFront:_badgeView];
100 |
101 | [_contentView addObserver:self
102 | forKeyPath:@"backgroundColor"
103 | options:NSKeyValueObservingOptionNew
104 | context:NULL];
105 | }
106 |
107 | - (void)dealloc
108 | {
109 | [_contentView removeObserver:self forKeyPath:@"backgroundColor"];
110 | }
111 |
112 | #pragma mark - NSKeyValueObserving
113 |
114 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
115 | {
116 | if (object == _contentView && !_selected && !_highlighted) {
117 | _userContentViewBackgroundColor = [change objectForKey:@"new"];
118 | }
119 | }
120 |
121 | #pragma mark - Getters
122 |
123 | - (UIView *)selectedBackgroundView
124 | {
125 | if (!_selectedBackgroundView)
126 | _selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds];
127 |
128 | _selectedBackgroundView.hidden = YES;
129 | _selectedBackgroundView.alpha = 0.f;
130 |
131 | return _selectedBackgroundView;
132 | }
133 |
134 | #pragma mark - Setters
135 |
136 | - (void)setAccessoryType:(KKGridViewCellAccessoryType)accessoryType
137 | {
138 | if (_accessoryType != accessoryType) {
139 | _accessoryType = accessoryType;
140 | [self setNeedsLayout];
141 | }
142 | }
143 |
144 | - (void)setEditing:(BOOL)editing animated:(BOOL)animated
145 | {
146 | if (animated) {
147 | [UIView beginAnimations:nil context:NULL];
148 | UIView.animationDuration = KKGridViewDefaultAnimationDuration;
149 | }
150 |
151 | self.editing = editing;
152 |
153 | if (animated)
154 | [UIView commitAnimations];
155 | }
156 |
157 | - (void)setPressedState:(BOOL)pressedState
158 | {
159 | if (pressedState) {
160 | if (!_selectedBackgroundView)
161 | _selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds];
162 |
163 | if (!_selectedBackgroundView.superview)
164 | [self addSubview:_selectedBackgroundView];
165 |
166 | if (!_selectedBackgroundView.backgroundColor)
167 | _selectedBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[self _defaultBlueBackgroundRendition]];
168 |
169 | _selectedBackgroundView.hidden = NO;
170 | _selectedBackgroundView.alpha = 1.f;
171 | } else {
172 | _selectedBackgroundView.hidden = YES;
173 | _selectedBackgroundView.alpha = 0.f;
174 | }
175 |
176 | [self setNeedsLayout];
177 | }
178 |
179 | - (void)setSelected:(BOOL)selected
180 | {
181 | if (_selected != selected) {
182 | _selected = selected;
183 | [self setPressedState:selected];
184 | }
185 | }
186 |
187 | - (void)setHighlighted:(BOOL)highlighted
188 | {
189 | if (_highlighted != highlighted) {
190 | _highlighted = highlighted;
191 | [self setPressedState:highlighted];
192 | }
193 | }
194 |
195 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
196 | {
197 | if (_selected != selected) {
198 | NSTimeInterval duration = animated ? 0.2 : 0;
199 | UIViewAnimationOptions opts = UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionAllowAnimatedContent;
200 |
201 | [UIView animateWithDuration:duration delay:0 options:opts animations:^{
202 | self.selected = selected; // use property access to go through the setter
203 | _selectedBackgroundView.alpha = selected ? _highlightAlpha : 0.f;
204 | } completion:^(BOOL finished) {
205 | [self setNeedsLayout];
206 | }];
207 | }
208 | }
209 |
210 | - (void)setSelectedBackgroundView:(UIView *)selectedBackgroundView
211 | {
212 | if (_selectedBackgroundView == selectedBackgroundView)
213 | return;
214 |
215 | _ignoreUserContentViewBackground = !!_selectedBackgroundView; // if we have a custom background view, we don't set the color.
216 |
217 | if (selectedBackgroundView)
218 | _selectedBackgroundView = selectedBackgroundView;
219 | else _selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds];
220 | }
221 |
222 | - (void)_updateSubviewSelectionState
223 | {
224 | for (UIControl *control in _contentView.subviews) {
225 | if ([control respondsToSelector:@selector(setSelected:)]) {
226 | control.selected = _highlighted || _selected;
227 | }
228 | }
229 | }
230 |
231 | #pragma mark - Layout
232 |
233 | - (void)layoutSubviews
234 | {
235 | [self _updateSubviewSelectionState];
236 |
237 | CGRect bounds = self.bounds;
238 | _contentView.frame = bounds;
239 |
240 | if (!_backgroundView.hidden)
241 | _backgroundView.frame = bounds;
242 | else _selectedBackgroundView.frame = bounds;
243 |
244 | if (_selectedBackgroundView)
245 | [self sendSubviewToBack:_selectedBackgroundView];
246 |
247 | [self sendSubviewToBack:_backgroundView];
248 | [self bringSubviewToFront:_contentView];
249 | [self bringSubviewToFront:_selectedBackgroundView];
250 | [self bringSubviewToFront:_badgeView];
251 |
252 | if (_selected || _highlighted) {
253 | _contentView.backgroundColor = [UIColor clearColor];
254 | _contentView.opaque = NO;
255 |
256 | _backgroundView.hidden = YES;
257 | _selectedBackgroundView.hidden = NO;
258 | _selectedBackgroundView.alpha = _highlightAlpha;
259 | } else {
260 | _contentView.backgroundColor = _userContentViewBackgroundColor ? _userContentViewBackgroundColor : [UIColor whiteColor];
261 |
262 | _backgroundView.hidden = NO;
263 | _selectedBackgroundView.hidden = YES;
264 | _selectedBackgroundView.alpha = 0.f;
265 | }
266 |
267 | [self _layoutAccessories];
268 | }
269 |
270 | - (void)_layoutAccessories
271 | {
272 | static const NSUInteger badgeCount = KKGridViewCellAccessoryTypeCheckmark + 1;
273 | static UIImage *normalBadges[badgeCount] = {0};
274 | static UIImage *pressedBadges[badgeCount] = {0};
275 |
276 | static dispatch_once_t onceToken;
277 | dispatch_once(&onceToken, ^{
278 | NSString *bundlePath = [[NSBundle mainBundle].resourcePath stringByAppendingPathComponent:@"KKGridView.bundle"];
279 | NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];
280 | UIImage *(^getBundleImage)(NSString *) = ^(NSString *n) {
281 | return [UIImage imageWithContentsOfFile:[bundle pathForResource:n ofType:@"png"]];
282 | };
283 |
284 | normalBadges[KKGridViewCellAccessoryTypeBadgeExclamatory] = getBundleImage(@"failure-btn");
285 | normalBadges[KKGridViewCellAccessoryTypeUnread] = getBundleImage(@"UIUnreadIndicator");
286 | normalBadges[KKGridViewCellAccessoryTypeReadPartial] = getBundleImage(@"UIUnreadIndicatorPartial");
287 | normalBadges[KKGridViewCellAccessoryTypeBadgeNumeric] = getBundleImage(@"failure-btn");
288 | normalBadges[KKGridViewCellAccessoryTypeCheckmark] = getBundleImage(@"UIPreferencesWhiteCheck");
289 |
290 | pressedBadges[KKGridViewCellAccessoryTypeBadgeExclamatory] = getBundleImage(@"failure-btn-pressed");
291 | pressedBadges[KKGridViewCellAccessoryTypeUnread] = getBundleImage(@"UIUnreadIndicatorPressed");
292 | pressedBadges[KKGridViewCellAccessoryTypeReadPartial] = getBundleImage(@"UIUnreadIndicatorPartialPressed");
293 | pressedBadges[KKGridViewCellAccessoryTypeBadgeNumeric] = getBundleImage(@"failure-btn-pressed");
294 | });
295 |
296 |
297 | switch (self.accessoryType) {
298 | case KKGridViewCellAccessoryTypeNone:
299 | [_badgeView removeFromSuperview];
300 | case KKGridViewCellAccessoryTypeNew:
301 | case KKGridViewCellAccessoryTypeInfo:
302 | case KKGridViewCellAccessoryTypeDelete:
303 | break;
304 | default: {
305 | if (!_badgeView) _badgeView = [[UIButton alloc] init];
306 | if (![_badgeView superview]) [self addSubview:_badgeView];
307 |
308 | [self bringSubviewToFront:_badgeView];
309 | break;
310 | }
311 | }
312 |
313 | _badgeView.userInteractionEnabled = NO;
314 |
315 | static const struct { CGFloat sideLength; CGFloat offset; } map[] = {
316 | [KKGridViewCellAccessoryTypeBadgeExclamatory] = {29.f, 0.f},
317 | [KKGridViewCellAccessoryTypeUnread] = {16.f, 3.f},
318 | [KKGridViewCellAccessoryTypeReadPartial] = {16.f, 3.f},
319 | [KKGridViewCellAccessoryTypeBadgeNumeric] = {29.f, 0.f},
320 | [KKGridViewCellAccessoryTypeCheckmark] = {14.f, 0.f},
321 | };
322 |
323 | CGFloat w = self.bounds.size.width;
324 | CGFloat h = self.bounds.size.height;
325 | CGFloat s = map[self.accessoryType].sideLength;
326 | CGFloat o = map[self.accessoryType].offset;
327 |
328 | CGPoint const pointMap[] = {
329 | [KKGridViewCellAccessoryPositionTopRight] = {w - s, o},
330 | [KKGridViewCellAccessoryPositionTopLeft] = {o, o},
331 | [KKGridViewCellAccessoryPositionBottomLeft] = {.y = h - s},
332 | [KKGridViewCellAccessoryPositionBottomRight] = {w - s, h - s},
333 | [KKGridViewCellAccessoryPositionCenter] = {(w - s)/2, (h - s)/2}
334 | };
335 |
336 | _badgeView.frame = (CGRect){pointMap[_accessoryPosition], {s-o, s-o}};
337 |
338 | if (normalBadges[self.accessoryType])
339 | {
340 | [_badgeView setBackgroundImage:normalBadges[self.accessoryType] forState:UIControlStateNormal];
341 | }
342 |
343 | if (pressedBadges[self.accessoryType])
344 | {
345 | [_badgeView setBackgroundImage:pressedBadges[self.accessoryType] forState:UIControlStateSelected];
346 | }
347 | }
348 |
349 | - (UIImage *)_defaultBlueBackgroundRendition
350 | {
351 | UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, [UIScreen mainScreen].scale);
352 | CGColorSpaceRef baseSpace = CGColorSpaceCreateDeviceRGB();
353 | static const CGFloat colors[] = {
354 | 0.063f, 0.459f, 0.949f, 1.0f,
355 | 0.028f, 0.26f, 0.877f, 1.0f
356 | };
357 |
358 | CGGradientRef gradient = CGGradientCreateWithColorComponents(baseSpace, colors, NULL, 2);
359 | CGColorSpaceRelease(baseSpace), baseSpace = NULL;
360 |
361 | CGFloat horizontalCenter = CGRectGetMidX(self.bounds);
362 | CGPoint startPoint = CGPointMake(horizontalCenter, CGRectGetMinY(self.bounds));
363 | CGPoint endPoint = CGPointMake(horizontalCenter, CGRectGetMaxY(self.bounds));
364 |
365 | CGContextDrawLinearGradient(UIGraphicsGetCurrentContext(), gradient, startPoint, endPoint, 0);
366 |
367 | CGGradientRelease(gradient), gradient = NULL;
368 | UIImage *rendition = UIGraphicsGetImageFromCurrentImageContext();
369 | UIGraphicsEndImageContext();
370 | return rendition;
371 | }
372 |
373 | #pragma mark - Subclassers
374 |
375 | - (void)prepareForReuse
376 | {
377 | self.selected = NO;
378 | }
379 |
380 | @end
381 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewController.h
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 10.22.11.
6 | // Copyright (c) 2011 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface KKGridViewController : UIViewController
12 |
13 | @property (nonatomic, strong) KKGridView *gridView;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewController.m
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 10.22.11.
6 | // Copyright (c) 2011 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import "KKGridViewController.h"
10 |
11 | @implementation KKGridViewController
12 | @synthesize gridView = _gridView;
13 |
14 | #pragma mark - View lifecycle
15 |
16 | - (void)loadView
17 | {
18 | [super loadView];
19 | _gridView = [[KKGridView alloc] initWithFrame:self.view.bounds];
20 | _gridView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
21 | _gridView.dataSource = self;
22 | _gridView.delegate = self;
23 | self.view = _gridView;
24 | }
25 |
26 | #pragma mark - KKGridViewDataSource
27 |
28 | - (NSUInteger)gridView:(KKGridView *)gridView numberOfItemsInSection:(NSUInteger)section
29 | {
30 | return 0;
31 | }
32 |
33 | - (KKGridViewCell *)gridView:(KKGridView *)gridView cellForItemAtIndexPath:(KKIndexPath *)indexPath
34 | {
35 | return [KKGridViewCell cellForGridView:gridView];
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewIndexView.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewIndexView.h
3 | // KKGridView
4 | //
5 | // Created by Simon Blommegård on 2011-12-22.
6 | //
7 |
8 | #import
9 |
10 | @interface KKGridViewIndexView : UIView
11 | @property (nonatomic, strong) NSArray *sectionIndexTitles; // Array with NSStrings
12 | @property (nonatomic, copy) void (^sectionTracked)(NSUInteger section);
13 | @property (nonatomic, assign) BOOL tracking;
14 |
15 | - (void)setTracking:(BOOL)tracking location:(CGPoint)location;
16 | @end
17 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewIndexView.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewIndexView.m
3 | // KKGridView
4 | //
5 | // Created by Simon Blommegård on 2011-12-22.
6 | //
7 |
8 | #import "KKGridViewIndexView.h"
9 |
10 | static UIColor *backgroundColor = nil;
11 | static UIColor *fontColor = nil;
12 | static UIFont *font = nil;
13 |
14 | static CGFloat const KKGridViewIndexViewPadding = 7.0;
15 | static CGFloat const KKGridViewIndexViewMargin = 7.0;
16 |
17 | @interface KKGridViewIndexView () {
18 | NSUInteger _lastTrackingSection;
19 | }
20 | @end
21 |
22 | @implementation KKGridViewIndexView
23 |
24 | @synthesize sectionIndexTitles = _sectionIndexTitles;
25 | @synthesize sectionTracked = _sectionTracked;
26 | @synthesize tracking = _tracking;
27 |
28 | + (void)initialize {
29 | if (self == [KKGridViewIndexView class]) {
30 | static dispatch_once_t onceToken;
31 | dispatch_once(&onceToken, ^{
32 | backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.25];
33 | fontColor = [UIColor colorWithWhite:0.0 alpha:0.75];
34 | font = [UIFont boldSystemFontOfSize:12.0];
35 | });
36 | }
37 | }
38 |
39 | - (id)initWithFrame:(CGRect)frame {
40 | if (self = [super initWithFrame:frame]) {
41 | self.opaque = NO;
42 | self.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
43 | }
44 |
45 | return self;
46 | }
47 |
48 | - (void)drawRect:(CGRect)rect {
49 |
50 | // If tracking, draw background
51 | if (_tracking) {
52 | [backgroundColor set];
53 |
54 | CGRect insetBounds = CGRectInset(self.bounds, KKGridViewIndexViewMargin, KKGridViewIndexViewMargin);
55 | CGFloat radius = (self.bounds.size.width - 2*KKGridViewIndexViewMargin) / 2;
56 | [[UIBezierPath bezierPathWithRoundedRect:insetBounds cornerRadius:radius] fill];
57 | }
58 |
59 | NSUInteger sections = [_sectionIndexTitles count];
60 | CGFloat sectionHeight = (self.bounds.size.height - 2 * KKGridViewIndexViewMargin)/sections;
61 | CGFloat currentSectionTop = KKGridViewIndexViewMargin;
62 |
63 | // Draw the titles in the center of its section
64 | [fontColor set];
65 |
66 | for (NSString *title in _sectionIndexTitles) {
67 | CGSize currentTitleSize = [title sizeWithFont:font];
68 | CGPoint drawingPoint = {
69 | floorf(self.bounds.size.width / 2 - currentTitleSize.width / 2),
70 | floorf(currentSectionTop + (sectionHeight / 2 - currentTitleSize.height / 2))
71 | };
72 |
73 | [title drawAtPoint:drawingPoint withFont:font];
74 | currentSectionTop+=sectionHeight;
75 | }
76 | }
77 |
78 | - (void)willMoveToSuperview:(UIView *)newSuperview {
79 | self.frame = (CGRect) {
80 | .origin.x = newSuperview.bounds.size.width - self.frame.size.width,
81 | .size.width = self.frame.size.width,
82 | .size.height = newSuperview.bounds.size.height
83 | };
84 | }
85 |
86 | #pragma mark - Setters
87 |
88 | - (void)setSectionIndexTitles:(NSArray *)sectionIndexTitles {
89 | _sectionIndexTitles = sectionIndexTitles;
90 |
91 | // Look for the largest title and set the width
92 | CGFloat maxWidth = 0.0;
93 |
94 | for (NSString *title in _sectionIndexTitles) {
95 | CGFloat currentWidth = [title sizeWithFont:font].width;
96 |
97 | if (currentWidth > maxWidth)
98 | maxWidth = currentWidth;
99 | }
100 |
101 | CGSize size = {
102 | maxWidth + 2*KKGridViewIndexViewPadding + 2*KKGridViewIndexViewMargin,
103 | self.frame.size.height
104 | };
105 |
106 | self.frame = (CGRect){self.frame.origin, size};
107 | [self setNeedsDisplay];
108 | }
109 |
110 | #pragma mark - Public
111 |
112 | - (void)setTracking:(BOOL)tracking location:(CGPoint)location {
113 | _tracking = tracking;
114 | if (_tracking && CGRectContainsPoint(self.bounds, location)) {
115 | NSUInteger sections = [_sectionIndexTitles count];
116 | CGFloat sectionHeight = (self.bounds.size.height - 2*KKGridViewIndexViewMargin)/sections;
117 | location.y -= KKGridViewIndexViewMargin;
118 |
119 | _lastTrackingSection = floorf(abs(location.y)/sectionHeight);
120 |
121 | if (_lastTrackingSection == _sectionIndexTitles.count)
122 | _lastTrackingSection--;
123 |
124 | if (_sectionTracked)
125 | _sectionTracked(_lastTrackingSection);
126 | }
127 |
128 | [self setNeedsDisplay];
129 | }
130 |
131 |
132 | @end
133 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewSectionInfo.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewSectionInfo.h
3 | // KKGridView
4 | //
5 | // Created by Jonathan Sterling on 7/31/11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | @interface KKGridViewSectionInfo : NSObject {
10 | @package
11 | CGFloat stickPoint;
12 | NSUInteger section;
13 | BOOL sticking;
14 | }
15 |
16 |
17 | @property (nonatomic, strong, readonly) UIView *view;
18 |
19 | - (id)initWithView:(UIView *)view;
20 |
21 | @end
22 |
23 | @compatibility_alias KKGridViewFooter KKGridViewSectionInfo;
24 | @compatibility_alias KKGridViewHeader KKGridViewSectionInfo;
25 | @compatibility_alias KKGridViewRowBackground KKGridViewSectionInfo;
26 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewSectionInfo.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewSectionInfo.m
3 | // KKGridView
4 | //
5 | // Created by Jonathan Sterling on 7/31/11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @implementation KKGridViewSectionInfo
12 |
13 | @synthesize view = _view;
14 |
15 | - (id)initWithView:(UIView *)view
16 | {
17 | if ((self = [super init])) {
18 | _view = view;
19 | }
20 |
21 | return self;
22 | }
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewSectionLabel.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewSectionLabel.h
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 4/26/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface KKGridViewSectionLabel : UILabel
12 |
13 | #pragma mark - Designated Initializer
14 |
15 | - (id)initWithString:(NSString *)string;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewSectionLabel.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewSectionLabel.m
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 4/26/12.
6 | // Copyright (c) 2012 Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import "KKGridViewSectionLabel.h"
10 |
11 | @implementation KKGridViewSectionLabel
12 |
13 | #pragma mark - Designated Initializer
14 |
15 | - (id)initWithString:(NSString *)string
16 | {
17 | if ((self = [super initWithFrame:CGRectZero])) {
18 | self.textColor = [UIColor whiteColor];
19 | self.font = [UIFont boldSystemFontOfSize:16.f];
20 | self.shadowColor = [[UIColor blackColor] colorWithAlphaComponent:0.75f];
21 | self.shadowOffset = CGSizeMake(0.f, 1.f);
22 | self.textAlignment = UITextAlignmentLeft;
23 | self.text = string;
24 | }
25 |
26 | return self;
27 | }
28 |
29 | #pragma mark - Drawing
30 |
31 | - (void)drawTextInRect:(CGRect)rect
32 | {
33 | UIEdgeInsets insets = UIEdgeInsetsMake(0.f, 12.f, 0.f, 0.f);
34 | return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewUpdate.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewUpdate.h
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 7.29.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | typedef enum {
13 | KKGridViewUpdateTypeItemInsert,
14 | KKGridViewUpdateTypeItemDelete,
15 | KKGridViewUpdateTypeItemReload,
16 | KKGridViewUpdateTypeItemMove,
17 | KKGridViewUpdateTypeSectionInsert,
18 | KKGridViewUpdateTypeSectionDelete,
19 | KKGridViewUpdateTypeSectionReload
20 | } KKGridViewUpdateType;
21 |
22 | typedef enum {
23 | KKGridViewUpdateSignNegative = -1,
24 | KKGridViewUpdateSignPositive = 1
25 | } KKGridViewUpdateSign;
26 |
27 | @interface KKGridViewUpdate : NSObject
28 |
29 | @property (nonatomic) KKGridViewAnimation animation;
30 | @property (nonatomic, copy) KKIndexPath * indexPath;
31 | @property (nonatomic) BOOL sectionUpdate;
32 | @property (nonatomic) KKGridViewUpdateType type;
33 | @property (nonatomic) BOOL animating;
34 | @property (nonatomic) CFTimeInterval timestamp;
35 | @property (nonatomic, copy) KKIndexPath *destinationPath;
36 |
37 | - (KKGridViewUpdateSign)sign;
38 |
39 | - (id)initWithIndexPath:(KKIndexPath *)indexPath isSectionUpdate:(BOOL)sectionUpdate type:(KKGridViewUpdateType)type animation:(KKGridViewAnimation)animation;
40 | + (id)updateWithIndexPath:(KKIndexPath *)indexPath isSectionUpdate:(BOOL)sectionUpdate type:(KKGridViewUpdateType)type animation:(KKGridViewAnimation)animation;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewUpdate.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewUpdate.m
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 7.29.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @implementation KKGridViewUpdate
12 |
13 | @synthesize animation = _animation;
14 | @synthesize animating = _animating;
15 | @synthesize indexPath = _indexPath;
16 | @synthesize sectionUpdate = _sectionUpdate;
17 | @synthesize timestamp = _timestamp;
18 | @synthesize destinationPath = _destinationPath;
19 | @synthesize type = _type;
20 |
21 | - (id)initWithIndexPath:(KKIndexPath *)indexPath isSectionUpdate:(BOOL)sectionUpdate type:(KKGridViewUpdateType)type animation:(KKGridViewAnimation)animation
22 | {
23 | if ((self = [super init])) {
24 | self.indexPath = indexPath;
25 | self.sectionUpdate = sectionUpdate;
26 | self.type = type;
27 | self.animation = animation;
28 | }
29 |
30 | return self;
31 | }
32 |
33 | + (id)updateWithIndexPath:(KKIndexPath *)indexPath isSectionUpdate:(BOOL)sectionUpdate type:(KKGridViewUpdateType)type animation:(KKGridViewAnimation)animation
34 | {
35 | return [[self alloc] initWithIndexPath:indexPath
36 | isSectionUpdate:sectionUpdate
37 | type:type
38 | animation:animation];
39 | }
40 |
41 | - (NSString *)description
42 | {
43 | return [NSString stringWithFormat:@"KKGridViewUpdate - IndexPath: %@, Type: %d, Section Update: %i",
44 | _indexPath, _type, _sectionUpdate];
45 | }
46 |
47 | - (BOOL)isEqual:(KKGridViewUpdate *)update
48 | {
49 | return [_indexPath isEqual:update.indexPath] && _sectionUpdate == update.sectionUpdate && _type == update.type && _animation == update.animation;
50 | }
51 |
52 | - (KKGridViewUpdateSign)sign
53 | {
54 | static BOOL const isNegative[KKGridViewUpdateTypeSectionReload + 1] = {
55 | [KKGridViewUpdateTypeItemDelete] = YES,
56 | [KKGridViewUpdateTypeSectionDelete] = YES
57 | };
58 |
59 | return isNegative[self.type] ? KKGridViewUpdateSignNegative : KKGridViewUpdateSignPositive;
60 | }
61 |
62 | - (NSUInteger)hash
63 | {
64 | return _indexPath.hash * self.animation;
65 | }
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewUpdateStack.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewUpdateStack.h
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 7.29.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class KKGridViewUpdate;
12 | @interface KKGridViewUpdateStack : NSObject
13 |
14 | @property (nonatomic, readonly, strong) NSMutableArray *itemsToUpdate;
15 |
16 | - (BOOL)addUpdate:(KKGridViewUpdate *)update;
17 | - (void)addUpdates:(NSArray *)updates;
18 | - (BOOL)hasUpdateForIndexPath:(KKIndexPath *)indexPath;
19 | - (KKGridViewUpdate *)updateForIndexPath:(KKIndexPath *)indexPath;
20 | - (void)removeUpdateForIndexPath:(KKIndexPath *)indexPath;
21 | - (void)removeUpdate:(KKGridViewUpdate *)update;
22 | - (KKIndexPath *)nextUpdateFromIndexPath:(KKIndexPath *)indexPath fallbackPath:(KKIndexPath *)fallback;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/KKGridView/KKGridViewUpdateStack.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKGridViewUpdateStack.m
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 7.29.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface KKGridViewUpdateStack () {
13 | CFMutableDictionaryRef _availableUpdates;
14 | }
15 |
16 | - (void)_sortItems;
17 | - (BOOL)addUpdate:(KKGridViewUpdate *)update sortingAfterAdd:(BOOL) sortAfterAdd;
18 |
19 | @end
20 |
21 | @implementation KKGridViewUpdateStack
22 |
23 | @synthesize itemsToUpdate = _itemsToUpdate;
24 |
25 | - (id)init
26 | {
27 | if ((self = [super init])) {
28 | _itemsToUpdate = [[NSMutableArray alloc] init];
29 | _availableUpdates = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
30 | }
31 |
32 | return self;
33 | }
34 |
35 | - (void)addUpdates:(NSArray *)updates
36 | {
37 | for (KKGridViewUpdate *update in updates) {
38 | [self addUpdate:update sortingAfterAdd:NO];
39 | }
40 | [self _sortItems];
41 | }
42 |
43 | - (BOOL)addUpdate:(KKGridViewUpdate *)update
44 | {
45 | return [self addUpdate:update sortingAfterAdd:YES];
46 | }
47 |
48 | - (BOOL)addUpdate:(KKGridViewUpdate *)update sortingAfterAdd:(BOOL) sortAfterAdd
49 | {
50 | if (![_itemsToUpdate containsObject:update]) {
51 | [_itemsToUpdate addObject:update];
52 | CFDictionaryAddValue(_availableUpdates, objc_unretainedPointer(update.indexPath), objc_unretainedPointer(update));
53 | [self _sortItems];
54 | return YES;
55 | }
56 |
57 | return NO;
58 | }
59 |
60 | - (void)removeUpdateForIndexPath:(KKIndexPath *)indexPath
61 | {
62 | KKGridViewUpdate *update = [self updateForIndexPath:indexPath];
63 | [self removeUpdate:update];
64 | }
65 |
66 | - (void)removeUpdate:(KKGridViewUpdate *)update
67 | {
68 | CFDictionaryRemoveValue(_availableUpdates, objc_unretainedPointer(update.indexPath));
69 | [_itemsToUpdate removeObject:update];
70 | }
71 |
72 | - (void)_sortItems
73 | {
74 | [_itemsToUpdate sortUsingDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"indexPath" ascending:YES]]];
75 | }
76 |
77 | - (KKGridViewUpdate *)updateForIndexPath:(KKIndexPath *)indexPath
78 | {
79 | return objc_unretainedObject(CFDictionaryGetValue(_availableUpdates, objc_unretainedPointer(indexPath)));
80 | }
81 |
82 | - (BOOL)hasUpdateForIndexPath:(KKIndexPath *)indexPath
83 | {
84 | KKGridViewUpdate *update = objc_unretainedObject(CFDictionaryGetValue(_availableUpdates, objc_unretainedPointer(indexPath)));
85 | if (update && !update.animating)
86 | return YES;
87 |
88 | return NO;
89 | }
90 |
91 | - (KKIndexPath *)nextUpdateFromIndexPath:(KKIndexPath *)indexPath fallbackPath:(KKIndexPath *)fallback
92 | {
93 | if (!_itemsToUpdate.count)
94 | return fallback;
95 |
96 | [self _sortItems];
97 | NSUInteger index = [_itemsToUpdate indexOfObject:[self updateForIndexPath:indexPath]];
98 | if ([_itemsToUpdate count] > (index + 1)) {
99 | KKGridViewUpdate *update = [_itemsToUpdate objectAtIndex:index + 1];
100 | return update.indexPath;
101 | }
102 |
103 | return fallback;
104 | }
105 |
106 | @end
107 |
--------------------------------------------------------------------------------
/KKGridView/KKIndexPath.h:
--------------------------------------------------------------------------------
1 | //
2 | // KKIndexPath.h
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 7.25.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | @interface KKIndexPath : NSObject
10 |
11 | #pragma mark - Initializers
12 |
13 | - (id)initWithIndex:(NSUInteger)index section:(NSUInteger)section;
14 | + (id)indexPathForIndex:(NSUInteger)index inSection:(NSUInteger)section;
15 |
16 | #pragma mark - NSIndexPath
17 |
18 | + (NSArray *)indexPathsWithNSIndexPaths:(NSArray *)indexPaths;
19 | - (id)initWithNSIndexPath:(NSIndexPath *)indexPath;
20 | + (id)indexPathWithNSIndexPath:(NSIndexPath *)indexPath;
21 | - (NSIndexPath *)NSIndexPath;
22 |
23 | #pragma mark - NSComparisonResult
24 |
25 | - (NSComparisonResult)compare:(id)other;
26 |
27 | #pragma mark - Convenience
28 |
29 | + (KKIndexPath *)nonexistantIndexPath;
30 | + (KKIndexPath *)zeroIndexPath;
31 |
32 | #pragma mark - Properties
33 |
34 | @property (nonatomic, readwrite) NSUInteger section;
35 | @property (nonatomic, readwrite) NSUInteger index;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/KKGridView/KKIndexPath.m:
--------------------------------------------------------------------------------
1 | //
2 | // KKIndexPath.m
3 | // KKGridView
4 | //
5 | // Created by Kolin Krewinkel on 7.25.11.
6 | // Copyright 2011 Giulio Petek, Jonathan Sterling, and Kolin Krewinkel. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @implementation KKIndexPath
12 |
13 | @synthesize index = _index;
14 | @synthesize section = _section;
15 |
16 | - (id)initWithIndex:(NSUInteger)index section:(NSUInteger)section
17 | {
18 | if ((self = [super init])) {
19 | _index = index;
20 | _section = section;
21 | }
22 |
23 | return self;
24 | }
25 |
26 | - (NSComparisonResult)compare:(KKIndexPath *)otherIndexPath
27 | {
28 | // Identical comparison
29 | if (otherIndexPath.section == self.section && otherIndexPath.index == self.index) {
30 | return NSOrderedSame;
31 | }
32 |
33 | // Sectional comparison
34 | if (otherIndexPath.section > self.section) {
35 | return NSOrderedAscending;
36 | } else if (otherIndexPath.section < self.section) {
37 | return NSOrderedDescending;
38 | }
39 |
40 | // Inter-section index comparison
41 | if (otherIndexPath.index > self.index) {
42 | return NSOrderedAscending;
43 | } else if (otherIndexPath.index < self.index) {
44 | return NSOrderedDescending;
45 | }
46 |
47 | // No result could be found (this should never happen, kept in to keep the compiler happy)
48 | return NSOrderedSame;
49 | }
50 |
51 | + (NSArray *)indexPathsWithNSIndexPaths:(NSArray *)indexPaths
52 | {
53 | NSMutableArray *convertedIndexPaths = [NSMutableArray array];
54 |
55 | for (NSIndexPath *indexPath in indexPaths) {
56 | [convertedIndexPaths addObject:[self indexPathWithNSIndexPath:indexPath]];
57 | }
58 |
59 | return convertedIndexPaths;
60 | }
61 |
62 | + (id)indexPathForIndex:(NSUInteger)index inSection:(NSUInteger)section
63 | {
64 | return [[self alloc] initWithIndex:index section:section];
65 | }
66 |
67 | - (id)initWithNSIndexPath:(NSIndexPath *)indexPath
68 | {
69 | if ((self = [super init])) {
70 | self.index = indexPath.row;
71 | self.section = indexPath.section;
72 | }
73 |
74 | return self;
75 | }
76 |
77 | + (id)indexPathWithNSIndexPath:(NSIndexPath *)indexPath
78 | {
79 | return [[self alloc] initWithNSIndexPath:indexPath];
80 | }
81 |
82 | - (BOOL)isEqual:(KKIndexPath *)indexPath
83 | {
84 | if (indexPath == self)
85 | return YES;
86 |
87 | return (indexPath->_index == _index && indexPath->_section == _section);
88 | }
89 |
90 | - (NSUInteger)hash
91 | {
92 | return _section + 7 * _index;
93 | }
94 |
95 | #pragma mark - NSCopying
96 |
97 | - (id)copyWithZone:(NSZone *)zone
98 | {
99 | KKIndexPath *indexPath = [[[self class] alloc] init];
100 | indexPath->_index = _index;
101 | indexPath->_section = _section;
102 | return indexPath;
103 | }
104 |
105 | - (NSString *)description
106 | {
107 | return [NSString stringWithFormat:@"%@ {Index: %i; Section: %i}",
108 | NSStringFromClass([self class]), _index, _section];
109 | }
110 |
111 | #pragma mark - KKIndexPath to NSIndexPath
112 |
113 | - (NSIndexPath *)NSIndexPath
114 | {
115 | return [NSIndexPath indexPathForRow:_index inSection:_section];
116 | }
117 |
118 | #pragma mark - Convenience
119 |
120 | + (KKIndexPath *)zeroIndexPath
121 | {
122 | static KKIndexPath *indexPath = nil;
123 |
124 | static dispatch_once_t onceToken;
125 | dispatch_once(&onceToken, ^{
126 | indexPath = [[self alloc] initWithIndex:0 section:0];
127 | });
128 |
129 | return indexPath;
130 | }
131 |
132 | + (KKIndexPath *)nonexistantIndexPath
133 | {
134 | static KKIndexPath *indexPath = nil;
135 |
136 | static dispatch_once_t onceToken;
137 | dispatch_once(&onceToken, ^{
138 | indexPath = [[self alloc] initWithIndex:NSUIntegerMax section:NSUIntegerMax];
139 | });
140 |
141 | return indexPath;
142 | }
143 |
144 | @end
145 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2011 by Kolin Krewinkel, Giulio Petek, Jonathan Sterling, Kyle
2 | Hickinson, Matthias Tretter, Kyle Hickinson.
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 |
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |

3 |
4 |
5 | ###Deprecated
6 | In iOS 6, Apple has now created a first-party solution to what KKGridView tries to solve. See Session 219 from WWDC 2012 for more information.
7 |
8 | ###Overview
9 | High-performance iOS grid view (MIT license). **Requirements**: you
10 | need to build `KKGridView` with a compiler that supports *Automatic
11 | Reference Counting*. We know this stings at first, but we strongly
12 | believe that the future is better served by requiring this
13 | now. Moreover, the move to ARC improved `KKGridView`'s performance
14 | greatly. Remember that your project need not use ARC to include
15 | `KKGridView`.
16 |
17 | ### Contributing
18 | If you see something you don't like, you are always
19 | welcome to submit it as an issue. But if you can find it in your
20 | heart, we'd be so grateful if you would fix it yourself and send us a
21 | pull request. We promise not to bite!
22 |
23 |
24 | ##Current Issues
25 |
26 | Most features, bugs, and missing items for the project are in the
27 | Issues section. Currently, there are placement issues after
28 | inserting. We were initially going to fix these before public
29 | release, but instead decided to release now and allow outside
30 | contribution. Other than that, editing and selection are the only
31 | things that need work.
32 |
33 | ##Motivations
34 |
35 | `KKGridView` was created in July 2011 for usage in a few of the apps I
36 | was working on. When I discovered that this would be both very
37 | difficult and time consuming, I sought out the help of [Giulio
38 | Petek](http://twitter.com/GiloTM) and [Jonathan
39 | Sterling](http://twitter.com/jonsterling). Additionally, we brought
40 | on [Kyle Hickinson](http://twitter.com/kylehickinson), [Matthias
41 | Tretter](http://twitter.com/myell0w), and most recently, [Peter
42 | Steinberger](http://twitter.com/steipete). We had all been frustrated
43 | by the existing grid view components; with this in mind, we set out to
44 | create the best grid view component available for iOS to-date.
45 |
46 | ##Goals
47 |
48 | When we set out building this, we all had a few common things we knew we needed to focus on.
49 |
50 | * Performance — 55+ FPS in the worst case.
51 | * `UITableView` similarities — Strive to be as close to drop-in as possible.
52 | * Feature completeness — As above, match the latest UITableView implementation in features; add anything else worthwhile.
53 | * Solid codebase — We didn't want something that was inextensible and
54 | full of messy code.
55 |
56 | ##Project Integration
57 |
58 | * Create a new workspace in Xcode in the same directory as your existing *.xcodeproj.
59 | * Drag in your existing Xcode project.
60 | * Locate your copy of KKGridView, drag KKGridView.xcodeproj into the workspace so that it stays at the top of the hierarchy, just like your original project.
61 | * In the Build Phases section of your original project, link your project with libKKGridView.a.
62 | * Now, simply import KKGridView just like an Apple framework:
63 |
64 | ~~~~objc
65 | #import
66 | ~~~~
67 | * You can do this wherever necessary, though we think it's best to simply import in your prefix (.pch) file.
68 |
69 | ##Usage
70 |
71 | KKGridViewController, like UITableViewController, can automatically instantiate a grid view for you. Simply subclass it and customize away.
72 |
73 | **As an alternative, one can perform custom instantiation, as shown below.**
74 |
75 | First, instantiate a grid view instance. *Using the designated initializer and a `_gridView` ivar:*
76 |
77 | ~~~~objc
78 | _gridView = [[KKGridView alloc] initWithFrame:self.view.bounds dataSource:self delegate:self];
79 | ~~~~
80 |
81 | Now, you can setup your default `UIScrollView` and `UIView` properties, since `KKGridView` inherits from said class.
82 |
83 | ~~~~objc
84 | _gridView.scrollsToTop = YES;
85 | _gridView.backgroundColor = [UIColor darkGrayColor];
86 | _gridView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
87 | ~~~~
88 |
89 | Metrics must also be set (automatic sizing *may* come in the future).
90 |
91 | ~~~~objc
92 | _gridView.cellSize = CGSizeMake(75.f, 75.f);
93 | _gridView.cellPadding = CGSizeMake(4.f, 4.f);
94 | ~~~~
95 |
96 | Now, other properties available in the header file can be set.
97 |
98 | ~~~~objc
99 | _gridView.allowsMultipleSelection = NO;
100 |
101 | UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 50.f)];
102 | headerView.backgroundColor = [UIColor redColor];
103 | _gridView.gridHeaderView = headerView;
104 | [headerView release] /* For the non-ARC users amongst us */
105 | ~~~~
106 |
107 | Finally, you can set the grid as your view.
108 |
109 | ~~~~objc
110 | self.view = _gridView;
111 | ~~~~
112 |
113 | Alternatively, you can add the grid to your view-hierarchy.
114 |
115 | ~~~~objc
116 | [self.view addSubview:_gridView];
117 | ~~~~
118 |
119 | ###Data source methods:
120 |
121 | ~~~~objc
122 | - (NSUInteger)gridView:(KKGridView *)gridView numberOfItemsInSection:(NSUInteger)section
123 | {
124 | return kCellCounts[section];
125 | }
126 | ~~~~
127 |
128 | Optionally, you can specify how many section you would like in the grid. *(Default is 1)*
129 |
130 | ~~~~objc
131 | - (NSUInteger)numberOfSectionsInGridView:(KKGridView *)gridView
132 | {
133 | return kNumSections;
134 | }
135 | ~~~~
136 |
137 | The last required method is to return a cell, just like UITableView.
138 | We've made it easier on you, though. `KKIndexPath` works in just the
139 | same way as `NSIndexPath`, only `-row` is replaced with
140 | `-index`. `KKGridViewCell`, like `UITableViewCell`, is designed to be
141 | subclassed.*
142 |
143 | ~~~~objc
144 | - (KKGridViewCell *)gridView:(KKGridView *)gridView cellForItemAtIndexPath:(KKIndexPath *)indexPath
145 | {
146 | KKGridViewCell *cell = [KKGridViewCell cellForGridView:gridView];
147 | cell.backgroundColor = [UIColor lightGrayColor];
148 | return cell;
149 | }
150 | ~~~~
151 |
152 | There are no required delegate methods, though all that are implemented in `UITableView` will soon be available in `KKGridView`.
153 |
--------------------------------------------------------------------------------
/Resources/Resources-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | com.kolinkrewinkel.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | BNDL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | CFPlugInDynamicRegisterFunction
26 |
27 | CFPlugInDynamicRegistration
28 | NO
29 | CFPlugInFactories
30 |
31 | 00000000-0000-0000-0000-000000000000
32 | MyFactoryFunction
33 |
34 | CFPlugInTypes
35 |
36 | 00000000-0000-0000-0000-000000000000
37 |
38 | 00000000-0000-0000-0000-000000000000
39 |
40 |
41 | CFPlugInUnloadFunction
42 |
43 | NSHumanReadableCopyright
44 | Copyright © 2011 Enkla. All rights reserved.
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Resources/Resources-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'Resources' target in the 'Resources' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #endif
8 |
--------------------------------------------------------------------------------
/Resources/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------