Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit. Split out from DTKit.

  • Loading branch information...
commit a224b799465caff327fe207fa4a070c3fe04eaa5 0 parents
@danielctull authored
Showing with 3,321 additions and 0 deletions.
  1. +14 −0 .hgignore
  2. +18 −0 Classes/DTGridViewAppDelegate.h
  3. +29 −0 Classes/DTGridViewAppDelegate.m
  4. +18 −0 Classes/DTGridViewExampleDataSourceAndDelegate.h
  5. +364 −0 Classes/DTGridViewExampleDataSourceAndDelegate.m
  6. +16 −0 Classes/DTInfiniteGridViewExampleViewController.h
  7. +93 −0 Classes/DTInfiniteGridViewExampleViewController.m
  8. +377 −0 Classes/DTSnapGridViewExampleCellView.xib
  9. +228 −0 Classes/DTSnapGridViewExampleView.xib
  10. +18 −0 Classes/DTSnapGridViewExampleViewController.h
  11. +76 −0 Classes/DTSnapGridViewExampleViewController.m
  12. +30 −0 DTGridView-Info.plist
  13. +333 −0 DTGridView.xcodeproj/project.pbxproj
  14. +198 −0 DTGridView/DTGridView.h
  15. +732 −0 DTGridView/DTGridView.m
  16. +40 −0 DTGridView/DTGridViewCell.h
  17. +45 −0 DTGridView/DTGridViewCell.m
  18. +12 −0 DTGridView/DTGridViewCellInfoProtocol.h
  19. +19 −0 DTGridView/DTGridViewController.h
  20. +60 −0 DTGridView/DTGridViewController.m
  21. +8 −0 DTGridView_Prefix.pch
  22. +26 −0 DTInfiniteGridView/DTInfiniteGridView.h
  23. +119 −0 DTInfiniteGridView/DTInfiniteGridView.m
  24. +20 −0 DTSnapGridView/DTLabelsSnapGridViewCell.h
  25. +70 −0 DTSnapGridView/DTLabelsSnapGridViewCell.m
  26. +24 −0 DTSnapGridView/DTSnapGridView.h
  27. +70 −0 DTSnapGridView/DTSnapGridView.m
  28. +20 −0 DTSnapGridView/DTSnapGridViewCell.h
  29. +36 −0 DTSnapGridView/DTSnapGridViewCell.m
  30. +191 −0 MainWindow.xib
  31. +17 −0 main.m
14 .hgignore
@@ -0,0 +1,14 @@
+syntax: glob
+
+.DS_Store
+
+*.swp
+*~.nib
+
+build
+
+*.pbxuser
+*.perspective
+*.perspectivev3
+
+*.mode[1-2]v3
18 Classes/DTGridViewAppDelegate.h
@@ -0,0 +1,18 @@
+//
+// DTGridViewAppDelegate.h
+// DTGridView
+//
+// Created by Daniel Tull on 10.02.2010.
+// Copyright Daniel Tull 2010. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface DTGridViewAppDelegate : NSObject <UIApplicationDelegate> {
+ UIWindow *window;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+
+@end
+
29 Classes/DTGridViewAppDelegate.m
@@ -0,0 +1,29 @@
+//
+// DTGridViewAppDelegate.m
+// DTGridView
+//
+// Created by Daniel Tull on 10.02.2010.
+// Copyright Daniel Tull 2010. All rights reserved.
+//
+
+#import "DTGridViewAppDelegate.h"
+
+@implementation DTGridViewAppDelegate
+
+@synthesize window;
+
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+
+ // Override point for customization after application launch
+ [window makeKeyAndVisible];
+}
+
+
+- (void)dealloc {
+ [window release];
+ [super dealloc];
+}
+
+
+@end
18 Classes/DTGridViewExampleDataSourceAndDelegate.h
@@ -0,0 +1,18 @@
+//
+// DTGridViewExampleDataSourceAndDelegate.h
+// DTKit
+//
+// Created by Daniel Tull on 19.04.2009.
+// Copyright 2009 Daniel Tull. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "DTGridViewController.h"
+
+@interface DTGridViewExampleDataSourceAndDelegate : DTGridViewController <UIPickerViewDataSource, UIPickerViewDelegate> {
+ NSArray *colours;
+ UIPickerView *pickerView;
+ UINavigationBar *navBar;
+}
+
+@end
364 Classes/DTGridViewExampleDataSourceAndDelegate.m
@@ -0,0 +1,364 @@
+//
+// DTGridViewExampleDataSourceAndDelegate.m
+// DTKit
+//
+// Created by Daniel Tull on 19.04.2009.
+// Copyright 2009 Daniel Tull. All rights reserved.
+//
+
+#import "DTGridViewExampleDataSourceAndDelegate.h"
+
+@implementation DTGridViewExampleDataSourceAndDelegate
+
+- (id)init {
+ if (![super init])
+ return nil;
+
+ colours = [[NSArray alloc] initWithObjects:
+ [UIColor redColor],
+ [UIColor blueColor],
+ [UIColor greenColor],
+ [UIColor magentaColor],
+ [UIColor yellowColor],
+ [UIColor whiteColor],
+ [UIColor grayColor],
+ [UIColor lightGrayColor],
+ [UIColor purpleColor],
+ [UIColor orangeColor],
+ nil];
+
+ return self;
+}
+
+- (void)dealloc {
+ [pickerView release];
+ [navBar release];
+ [colours release];
+ [super dealloc];
+}
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Scroll" style:UIBarButtonItemStyleBordered target:self action:@selector(scroll)] autorelease];
+ self.title = @"DTGridView";
+ self.gridView.gridDelegate = self;
+ self.gridView.dataSource = self;
+ self.gridView.bounces = YES;
+}
+
+- (void)scroll {
+
+ if (!pickerView)
+ pickerView = [[UIPickerView alloc] init];
+
+ if (!navBar)
+ navBar = [[UINavigationBar alloc] initWithFrame:self.navigationController.navigationBar.frame];
+
+// navBar.title = @"Scroll GridView";
+
+ navBar.barStyle = UIBarStyleBlack;
+ UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"Scroll GridView"];
+ item.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Scroll To" style:UIBarButtonItemStylePlain target:self action:@selector(scrollTo)] autorelease];
+ item.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(endScrolling)] autorelease];
+ [navBar pushNavigationItem:item animated:NO];
+ [item release];
+ [self.navigationController.navigationBar.superview insertSubview:navBar belowSubview:self.navigationController.navigationBar];
+
+ pickerView.dataSource = self;
+ pickerView.delegate = self;
+ [self.view addSubview:pickerView];
+ pickerView.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y - pickerView.frame.size.height, pickerView.frame.size.width, pickerView.frame.size.height);
+
+ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:NO];
+
+ [UIView beginAnimations:@"pickerShow" context:nil];
+ self.gridView.contentInset = UIEdgeInsetsMake(pickerView.frame.size.height, 0, 0, 0);//(self.gridView.frame.origin.x, self.gridView.frame.origin.y + pickerView.frame.size.height, self.gridView.frame.size.width, self.gridView.frame.size.height - pickerView.frame.size.height);
+ self.gridView.scrollIndicatorInsets = UIEdgeInsetsMake(pickerView.frame.size.height, 0, 0, 0);
+
+ //self.gridView.frame = CGRectMake(self.gridView.frame.origin.x, self.gridView.frame.origin.y + pickerView.frame.size.height, self.gridView.frame.size.width, self.gridView.frame.size.height - pickerView.frame.size.height);
+ self.navigationController.navigationBar.frame = CGRectMake(self.navigationController.navigationBar.frame.origin.x, self.navigationController.navigationBar.frame.origin.y - self.navigationController.navigationBar.frame.size.height, self.navigationController.navigationBar.frame.size.width, self.navigationController.navigationBar.frame.size.height);
+ pickerView.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, pickerView.frame.size.width, pickerView.frame.size.height);
+
+ [UIView commitAnimations];
+
+ //[self.gridView scrollViewToRow:1 column:1 scrollPosition:DTGridViewScrollPositionNone animated:YES];
+}
+
+- (void)scrollTo {
+ [self.gridView scrollViewToRow:[pickerView selectedRowInComponent:0] column:[pickerView selectedRowInComponent:1] scrollPosition:DTGridViewScrollPositionNone animated:YES];
+}
+
+
+- (void)endScrolling {
+ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];
+ [UIView beginAnimations:@"pickerHide" context:nil];
+ self.gridView.contentInset = UIEdgeInsetsZero;
+ self.gridView.scrollIndicatorInsets = UIEdgeInsetsZero;
+
+ self.navigationController.navigationBar.frame = CGRectMake(self.navigationController.navigationBar.frame.origin.x, self.navigationController.navigationBar.frame.origin.y + self.navigationController.navigationBar.frame.size.height, self.navigationController.navigationBar.frame.size.width, self.navigationController.navigationBar.frame.size.height);
+ pickerView.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y - pickerView.frame.size.height, pickerView.frame.size.width, pickerView.frame.size.height);
+ //self.gridView.frame = CGRectMake(self.gridView.frame.origin.x, self.gridView.frame.origin.y - pickerView.frame.size.height, self.gridView.frame.size.width, self.gridView.frame.size.height + pickerView.frame.size.height);
+ [UIView commitAnimations];
+}
+
+- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component {
+ return 100.0;
+}
+
+//- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
+// [self.gridView scrollViewToRow:row column:component scrollPosition:DTGridViewScrollPositionNone animated:YES];
+//}
+
+
+- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
+ return 2;
+}
+
+- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
+ return 25;
+}
+
+- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
+ return [NSString stringWithFormat:@"%i", row];
+}
+
+- (NSInteger)spacingBetweenRowsInGridView:(DTGridView *)gridView {
+ return 7;
+}
+
+- (NSInteger)spacingBetweenColumnsInGridView:(DTGridView *)gridView {
+ return 4;
+}
+- (NSInteger)numberOfRowsInGridView:(DTGridView *)gridView {
+ return 25;
+}
+- (NSInteger)numberOfColumnsInGridView:(DTGridView *)gridView forRowWithIndex:(NSInteger)index {
+ return 25;
+}
+
+- (CGFloat)gridView:(DTGridView *)gridView heightForRow:(NSInteger)rowIndex {
+ return 100.0;
+}
+- (CGFloat)gridView:(DTGridView *)gridView widthForCellAtRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
+
+ return 100.0;
+
+ if (rowIndex == 0) {
+ if (columnIndex == 0)
+ return 120.0;
+ else if (columnIndex == 1)
+ return 200.0;
+ else if (columnIndex == 2)
+ return 20.0;
+ else if (columnIndex == 3)
+ return 60.0;
+ else if (columnIndex == 4)
+ return 100.0;
+ } else if (rowIndex == 1){
+ if (columnIndex == 0)
+ return 30.0;
+ else if (columnIndex == 1)
+ return 170.0;
+ else if (columnIndex == 2)
+ return 200.0;
+ else if (columnIndex == 3)
+ return 40.0;
+ else if (columnIndex == 4)
+ return 60.0;
+ } else if (rowIndex == 2){
+ if (columnIndex == 0)
+ return 30.0;
+ else if (columnIndex == 1)
+ return 160.0;
+ else if (columnIndex == 2)
+ return 110.0;
+ else if (columnIndex == 3)
+ return 70.0;
+ else if (columnIndex == 4)
+ return 130.0;
+ } else if (rowIndex == 3) {
+ if (columnIndex == 0)
+ return 100.0;
+ else if (columnIndex == 1)
+ return 100.0;
+ else if (columnIndex == 2)
+ return 100.0;
+ else if (columnIndex == 3)
+ return 100.0;
+ else if (columnIndex == 4)
+ return 100.0;
+ } else if (rowIndex == 4){
+ if (columnIndex == 0)
+ return 100.0;
+ else if (columnIndex == 1)
+ return 100.0;
+ else if (columnIndex == 2)
+ return 100.0;
+ else if (columnIndex == 3)
+ return 100.0;
+ else if (columnIndex == 4)
+ return 100.0;
+ } else if (rowIndex == 5){
+ if (columnIndex == 0)
+ return 100.0;
+ else if (columnIndex == 1)
+ return 100.0;
+ else if (columnIndex == 2)
+ return 100.0;
+ else if (columnIndex == 3)
+ return 100.0;
+ else if (columnIndex == 4)
+ return 100.0;
+ } else if (rowIndex == 6){
+ if (columnIndex == 0)
+ return 100.0;
+ else if (columnIndex == 1)
+ return 100.0;
+ else if (columnIndex == 2)
+ return 100.0;
+ else if (columnIndex == 3)
+ return 100.0;
+ else if (columnIndex == 4)
+ return 100.0;
+ } else if (rowIndex == 7) {
+ if (columnIndex == 0)
+ return 100.0;
+ else if (columnIndex == 1)
+ return 100.0;
+ else if (columnIndex == 2)
+ return 100.0;
+ else if (columnIndex == 3)
+ return 100.0;
+ else if (columnIndex == 4)
+ return 100.0;
+ }
+ return 150.0;
+}
+
+//- (NSNumber *)gridView:(DTGridView *)gridView heightForRowAtIndex:(NSInteger)index;
+- (DTGridViewCell *)gridView:(DTGridView *)gv viewForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
+
+ //NSLog(@"gridView: viewForRow:%i column:%i", rowIndex, columnIndex);
+
+ DTGridViewCell *view = [[gv dequeueReusableCellWithIdentifier:@"cell"] retain];
+
+ //NSLog(@"%s ASKING", _cmd);
+
+ if (!view) {
+ //NSLog(@"%s NEW CELL", _cmd);
+ view = [[DTGridViewCell alloc] initWithReuseIdentifier:@"cell"];
+ }
+ //view.frame = CGRectMake(0,0,150,150);
+
+// int r = random() % 10;
+
+ view.backgroundColor = [colours objectAtIndex:(random() % 10)];
+ /*
+ if (rowIndex == 0) {
+ if (columnIndex == 0)
+ view.backgroundColor = [UIColor redColor];
+ else if (columnIndex == 1)
+ view.backgroundColor = [UIColor blueColor];
+ else if (columnIndex == 2)
+ view.backgroundColor = [UIColor purpleColor];
+ else if (columnIndex == 3)
+ view.backgroundColor = [UIColor orangeColor];
+ else if (columnIndex == 4)
+ view.backgroundColor = [UIColor whiteColor];
+ } else if (rowIndex == 1){
+ if (columnIndex == 0)
+ view.backgroundColor = [UIColor lightGrayColor];
+ else if (columnIndex == 1)
+ view.backgroundColor = [UIColor grayColor];
+ else if (columnIndex == 2)
+ view.backgroundColor = [UIColor redColor];
+ else if (columnIndex == 3)
+ view.backgroundColor = [UIColor greenColor];
+ else if (columnIndex == 4)
+ view.backgroundColor = [UIColor magentaColor];
+ } else if (rowIndex == 2){
+ if (columnIndex == 0)
+ view.backgroundColor = [UIColor redColor];
+ else if (columnIndex == 1)
+ view.backgroundColor = [UIColor blueColor];
+ else if (columnIndex == 2)
+ view.backgroundColor = [UIColor purpleColor];
+ else if (columnIndex == 3)
+ view.backgroundColor = [UIColor orangeColor];
+ else if (columnIndex == 4)
+ view.backgroundColor = [UIColor whiteColor];
+ } else if (rowIndex == 3) {
+ if (columnIndex == 0)
+ view.backgroundColor = [UIColor lightGrayColor];
+ else if (columnIndex == 1)
+ view.backgroundColor = [UIColor grayColor];
+ else if (columnIndex == 2)
+ view.backgroundColor = [UIColor yellowColor];
+ else if (columnIndex == 3)
+ view.backgroundColor = [UIColor greenColor];
+ else if (columnIndex == 4)
+ view.backgroundColor = [UIColor magentaColor];
+ } else if (rowIndex == 4){
+ if (columnIndex == 0)
+ view.backgroundColor = [UIColor redColor];
+ else if (columnIndex == 1)
+ view.backgroundColor = [UIColor blueColor];
+ else if (columnIndex == 2)
+ view.backgroundColor = [UIColor purpleColor];
+ else if (columnIndex == 3)
+ view.backgroundColor = [UIColor orangeColor];
+ else if (columnIndex == 4)
+ view.backgroundColor = [UIColor whiteColor];
+ } else if (rowIndex == 5){
+ if (columnIndex == 0)
+ view.backgroundColor = [UIColor lightGrayColor];
+ else if (columnIndex == 1)
+ view.backgroundColor = [UIColor grayColor];
+ else if (columnIndex == 2)
+ view.backgroundColor = [UIColor yellowColor];
+ else if (columnIndex == 3)
+ view.backgroundColor = [UIColor greenColor];
+ else if (columnIndex == 4)
+ view.backgroundColor = [UIColor magentaColor];
+ } else if (rowIndex == 6){
+ if (columnIndex == 0)
+ view.backgroundColor = [UIColor redColor];
+ else if (columnIndex == 1)
+ view.backgroundColor = [UIColor blueColor];
+ else if (columnIndex == 2)
+ view.backgroundColor = [UIColor purpleColor];
+ else if (columnIndex == 3)
+ view.backgroundColor = [UIColor orangeColor];
+ else if (columnIndex == 4)
+ view.backgroundColor = [UIColor whiteColor];
+ } else if (rowIndex == 7) {
+ if (columnIndex == 0)
+ view.backgroundColor = [UIColor lightGrayColor];
+ else if (columnIndex == 1)
+ view.backgroundColor = [UIColor grayColor];
+ else if (columnIndex == 2)
+ view.backgroundColor = [UIColor yellowColor];
+ else if (columnIndex == 3)
+ view.backgroundColor = [UIColor greenColor];
+ else if (columnIndex == 4)
+ view.backgroundColor = [UIColor magentaColor];
+ }
+ */
+ return [view autorelease];
+}
+
+// Override to allow orientations other than the default portrait orientation.
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ // Return YES for supported orientations
+ return YES;
+}
+
+- (void)gridView:(DTGridView *)gridView selectionMadeAtRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
+ NSLog(@"%@:%s", self, _cmd);
+}
+
+- (void)gridView:(DTGridView *)gridView scrolledToEdge:(DTGridViewEdge)edge {
+ //NSLog(@"%@:%s", self, _cmd);
+}
+
+@end
16 Classes/DTInfiniteGridViewExampleViewController.h
@@ -0,0 +1,16 @@
+//
+// DTInfiniteGridViewExampleViewController.h
+// DTKit
+//
+// Created by Daniel Tull on 11.08.2009.
+// Copyright 2009 Daniel Tull. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "DTInfiniteGridView.h"
+
+@interface DTInfiniteGridViewExampleViewController : UIViewController <DTGridViewDelegate, DTGridViewDataSource> {
+ DTInfiniteGridView *gridView;
+}
+
+@end
93 Classes/DTInfiniteGridViewExampleViewController.m
@@ -0,0 +1,93 @@
+//
+// DTInfiniteGridViewExampleViewController.m
+// DTKit
+//
+// Created by Daniel Tull on 11.08.2009.
+// Copyright 2009 Daniel Tull. All rights reserved.
+//
+
+#import "DTInfiniteGridViewExampleViewController.h"
+
+
+@implementation DTInfiniteGridViewExampleViewController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.title = @"DTInfinteGridView";
+ self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ self.view.autoresizesSubviews = YES;
+ gridView = [[DTInfiniteGridView alloc] initWithFrame:self.view.bounds];
+ gridView.autoresizingMask = self.view.autoresizingMask;
+ gridView.dataSource = self;
+ gridView.infiniteVerticalScrolling = NO;
+ gridView.infiniteHorizontalScrolling = YES;
+ gridView.gridDelegate = self;
+ gridView.pagingEnabled = NO;
+ [self.view addSubview:gridView];
+}
+
+
+/*
+// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
+- (void)viewDidLoad {
+ [super viewDidLoad];
+}
+*/
+
+/*
+// Override to allow orientations other than the default portrait orientation.
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ // Return YES for supported orientations
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+*/
+
+- (void)didReceiveMemoryWarning {
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc that aren't in use.
+}
+
+- (void)viewDidUnload {
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+
+- (void)dealloc {
+ [super dealloc];
+}
+- (NSInteger)numberOfRowsInGridView:(DTGridView *)gridView {
+ return 1;
+}
+- (NSInteger)numberOfColumnsInGridView:(DTGridView *)gridView forRowWithIndex:(NSInteger)index {
+ return 4;
+}
+- (CGFloat)gridView:(DTGridView *)gv heightForRow:(NSInteger)rowIndex {
+ return gv.frame.size.height;
+}
+- (CGFloat)gridView:(DTGridView *)gv widthForCellAtRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
+ return gv.frame.size.width / 2;
+}
+- (DTGridViewCell *)gridView:(DTGridView *)gv viewForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
+ DTGridViewCell *view = [[gv dequeueReusableCellWithIdentifier:@"cell"] retain];
+
+ if (!view)
+ view = [[DTGridViewCell alloc] initWithReuseIdentifier:@"cell"];
+
+ if (columnIndex == 0)
+ view.backgroundColor = [UIColor redColor];
+ else if (columnIndex == 1)
+ view.backgroundColor = [UIColor blueColor];
+ else if (columnIndex == 2)
+ view.backgroundColor = [UIColor orangeColor];
+ else if (columnIndex == 3)
+ view.backgroundColor = [UIColor yellowColor];
+ else
+ NSLog(@"%@:%s FAIL: %i", self, _cmd, columnIndex);
+
+ return [view autorelease];
+}
+
+@end
377 Classes/DTSnapGridViewExampleCellView.xib
@@ -0,0 +1,377 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">768</int>
+ <string key="IBDocument.SystemVersion">10A421a</string>
+ <string key="IBDocument.InterfaceBuilderVersion">732</string>
+ <string key="IBDocument.AppKitVersion">1038</string>
+ <string key="IBDocument.HIToolboxVersion">435.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">58</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="1"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ </object>
+ <object class="IBUIView" id="191373211">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUILabel" id="647234027">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{0, 20}, {35, 21}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="IBUIText">Title</string>
+ <object class="NSFont" key="IBUIFont">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">17</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDAAA</bytes>
+ </object>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">10</float>
+ </object>
+ <object class="IBUIImageView" id="742176169">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{0, 49}, {57, 57}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <int key="IBUIContentMode">4</int>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <object class="NSCustomResource" key="IBUIImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">Icon.png</string>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{112, 126}</string>
+ <reference key="NSSuperview"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="191373211"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="742176169"/>
+ <reference ref="647234027"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3</int>
+ <reference key="object" ref="647234027"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">4</int>
+ <reference key="object" ref="742176169"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-2.CustomClassName</string>
+ <string>1.CustomClassName</string>
+ <string>1.IBEditorWindowLastContentRect</string>
+ <string>1.IBPluginDependency</string>
+ <string>3.IBPluginDependency</string>
+ <string>4.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>UIResponder</string>
+ <string>DTSnapGridViewCell</string>
+ <string>{{354, 730}, {112, 126}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">9</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">DTGridViewCell</string>
+ <string key="superclassName">UIView</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">delegate</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">DTGridView/DTGridViewCell.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">DTSnapGridViewCell</string>
+ <string key="superclassName">DTGridViewCell</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">DTSnapGridView/DTSnapGridViewCell.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UILabel</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">DTLabels/UILabel+DTCopyLabel.h</string>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSError.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSNetServices.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSPort.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSStream.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSXMLParser.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="835768793">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIImageView</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIImageView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UILabel</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UILabel.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIResponder</string>
+ <string key="superclassName">NSObject</string>
+ <reference key="sourceIdentifier" ref="835768793"/>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIView</string>
+ <string key="superclassName">UIResponder</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIView.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
+ <integer value="768" key="NS.object.0"/>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3100" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../DTKit.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">3.0</string>
+ </data>
+</archive>
228 Classes/DTSnapGridViewExampleView.xib
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">544</int>
+ <string key="IBDocument.SystemVersion">10A394</string>
+ <string key="IBDocument.InterfaceBuilderVersion">732</string>
+ <string key="IBDocument.AppKitVersion">1027.1</string>
+ <string key="IBDocument.HIToolboxVersion">430.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">58</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="1"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ </object>
+ <object class="IBUIView" id="191373211">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUIScrollView" id="984514144">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrameSize">{320, 460}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ <bool key="IBUIBouncesZoom">NO</bool>
+ </object>
+ </object>
+ <string key="NSFrameSize">{320, 460}</string>
+ <reference key="NSSuperview"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="191373211"/>
+ </object>
+ <int key="connectionID">4</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">dataSource</string>
+ <reference key="source" ref="984514144"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">5</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">snapGridView</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="984514144"/>
+ </object>
+ <int key="connectionID">6</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="191373211"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="984514144"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3</int>
+ <reference key="object" ref="984514144"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>1.IBEditorWindowLastContentRect</string>
+ <string>1.IBPluginDependency</string>
+ <string>3.CustomClassName</string>
+ <string>3.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>DTSnapGridViewExampleViewController</string>
+ <string>UIResponder</string>
+ <string>{{354, 396}, {320, 460}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>DTSnapGridView</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">6</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">DTGridView</string>
+ <string key="superclassName">UIScrollView</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>dataSource</string>
+ <string>gridDelegate</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSObject</string>
+ <string>NSObject</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">DTGridView/DTGridView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">DTSnapGridView</string>
+ <string key="superclassName">DTGridView</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">gridDelegate</string>
+ <string key="NS.object.0">NSObject</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">DTSnapGridView/DTSnapGridView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">DTSnapGridViewExampleViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">snapGridView</string>
+ <string key="NS.object.0">DTSnapGridView</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">DTSnapGridView/DTSnapGridViewExampleViewController.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
+ <integer value="544" key="NS.object.0"/>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3100" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../DTKit.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">3.0</string>
+ </data>
+</archive>
18 Classes/DTSnapGridViewExampleViewController.h
@@ -0,0 +1,18 @@
+//
+// DTSnapGridViewExampleViewController.h
+// DTKit
+//
+// Created by Daniel Tull on 09.07.2009.
+// Copyright 2009 Daniel Tull. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "DTSnapGridView.h"
+
+@interface DTSnapGridViewExampleViewController : UIViewController {
+ DTSnapGridView *snapGridView;
+}
+
+@property (nonatomic, retain) IBOutlet DTSnapGridView *snapGridView;
+
+@end
76 Classes/DTSnapGridViewExampleViewController.m
@@ -0,0 +1,76 @@
+//
+// DTSnapGridViewExampleViewController.m
+// DTKit
+//
+// Created by Daniel Tull on 09.07.2009.
+// Copyright 2009 Daniel Tull. All rights reserved.
+//
+
+#import "DTSnapGridViewExampleViewController.h"
+
+@implementation DTSnapGridViewExampleViewController
+
+@synthesize snapGridView;
+
+- (id)init {
+
+ if (!(self = [self initWithNibName:@"DTSnapGridViewExampleView" bundle:nil])) return nil;
+
+ self.title = @"DTSnapGridView";
+
+ return self;
+
+}
+
+
+- (void)didReceiveMemoryWarning {
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc that aren't in use.
+}
+
+- (void)viewDidUnload {
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+#pragma mark DTGridViewDataSource Methods
+
+- (NSInteger)numberOfRowsInGridView:(DTGridView *)gv {
+ return 1;
+}
+
+- (NSInteger)numberOfColumnsInGridView:(DTGridView *)gv forRowWithIndex:(NSInteger)index {
+ return 20;
+}
+
+- (CGFloat)gridView:(DTGridView *)gv heightForRow:(NSInteger)rowIndex {
+ return gv.frame.size.height;
+}
+
+- (CGFloat)gridView:(DTGridView *)gv widthForCellAtRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
+ return gv.frame.size.width/3.0;
+}
+
+- (DTGridViewCell *)gridView:(DTGridView *)gv viewForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
+
+ NSLog(@"%@:%s", self, _cmd);
+
+ DTGridViewCell *cell = [gv dequeueReusableCellWithIdentifier:@"cell"];
+
+ if (!cell) {
+ cell = [[[NSBundle mainBundle] loadNibNamed:@"DTSnapGridViewExampleCellView" owner:self options:nil] objectAtIndex:0];
+ cell.identifier = @"cell";
+ }
+
+ return cell;
+}
+
+
+@end
30 DTGridView-Info.plist
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+</dict>
+</plist>
333 DTGridView.xcodeproj/project.pbxproj
@@ -0,0 +1,333 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1D3623260D0F684500981E51 /* DTGridViewAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* DTGridViewAppDelegate.m */; };
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 2428E8A5112374BF0019252F /* DTGridView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2428E89D112374BF0019252F /* DTGridView.m */; };
+ 2428E8A7112374BF0019252F /* DTGridViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2428E8A0112374BF0019252F /* DTGridViewCell.m */; };
+ 2428E8A8112374BF0019252F /* DTGridViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2428E8A3112374BF0019252F /* DTGridViewController.m */; };
+ 2428E8B1112374E00019252F /* DTLabelsSnapGridViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2428E8AC112374E00019252F /* DTLabelsSnapGridViewCell.m */; };
+ 2428E8B2112374E00019252F /* DTSnapGridView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2428E8AE112374E00019252F /* DTSnapGridView.m */; };
+ 2428E8B3112374E00019252F /* DTSnapGridViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2428E8B0112374E00019252F /* DTSnapGridViewCell.m */; };
+ 2428E8B7112374E90019252F /* DTInfiniteGridView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2428E8B6112374E90019252F /* DTInfiniteGridView.m */; };
+ 2428E8D0112375660019252F /* DTGridViewExampleDataSourceAndDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2428E8C9112375660019252F /* DTGridViewExampleDataSourceAndDelegate.m */; };
+ 2428E8D1112375660019252F /* DTInfiniteGridViewExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2428E8CB112375660019252F /* DTInfiniteGridViewExampleViewController.m */; };
+ 2428E8D2112375660019252F /* DTSnapGridViewExampleCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2428E8CC112375660019252F /* DTSnapGridViewExampleCellView.xib */; };
+ 2428E8D3112375660019252F /* DTSnapGridViewExampleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2428E8CD112375660019252F /* DTSnapGridViewExampleView.xib */; };
+ 2428E8D4112375660019252F /* DTSnapGridViewExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2428E8CF112375660019252F /* DTSnapGridViewExampleViewController.m */; };
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
+ 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1D3623240D0F684500981E51 /* DTGridViewAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTGridViewAppDelegate.h; sourceTree = "<group>"; };
+ 1D3623250D0F684500981E51 /* DTGridViewAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTGridViewAppDelegate.m; sourceTree = "<group>"; };
+ 1D6058910D05DD3D006BFB54 /* DTGridView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DTGridView.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 2428E89C112374BF0019252F /* DTGridView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTGridView.h; sourceTree = "<group>"; };
+ 2428E89D112374BF0019252F /* DTGridView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTGridView.m; sourceTree = "<group>"; };
+ 2428E89F112374BF0019252F /* DTGridViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTGridViewCell.h; sourceTree = "<group>"; };
+ 2428E8A0112374BF0019252F /* DTGridViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTGridViewCell.m; sourceTree = "<group>"; };
+ 2428E8A1112374BF0019252F /* DTGridViewCellInfoProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTGridViewCellInfoProtocol.h; sourceTree = "<group>"; };
+ 2428E8A2112374BF0019252F /* DTGridViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTGridViewController.h; sourceTree = "<group>"; };
+ 2428E8A3112374BF0019252F /* DTGridViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTGridViewController.m; sourceTree = "<group>"; };
+ 2428E8AB112374E00019252F /* DTLabelsSnapGridViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTLabelsSnapGridViewCell.h; sourceTree = "<group>"; };
+ 2428E8AC112374E00019252F /* DTLabelsSnapGridViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTLabelsSnapGridViewCell.m; sourceTree = "<group>"; };
+ 2428E8AD112374E00019252F /* DTSnapGridView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTSnapGridView.h; sourceTree = "<group>"; };
+ 2428E8AE112374E00019252F /* DTSnapGridView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTSnapGridView.m; sourceTree = "<group>"; };
+ 2428E8AF112374E00019252F /* DTSnapGridViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTSnapGridViewCell.h; sourceTree = "<group>"; };
+ 2428E8B0112374E00019252F /* DTSnapGridViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTSnapGridViewCell.m; sourceTree = "<group>"; };
+ 2428E8B5112374E90019252F /* DTInfiniteGridView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTInfiniteGridView.h; sourceTree = "<group>"; };
+ 2428E8B6112374E90019252F /* DTInfiniteGridView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTInfiniteGridView.m; sourceTree = "<group>"; };
+ 2428E8C8112375660019252F /* DTGridViewExampleDataSourceAndDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTGridViewExampleDataSourceAndDelegate.h; sourceTree = "<group>"; };
+ 2428E8C9112375660019252F /* DTGridViewExampleDataSourceAndDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTGridViewExampleDataSourceAndDelegate.m; sourceTree = "<group>"; };
+ 2428E8CA112375660019252F /* DTInfiniteGridViewExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTInfiniteGridViewExampleViewController.h; sourceTree = "<group>"; };
+ 2428E8CB112375660019252F /* DTInfiniteGridViewExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTInfiniteGridViewExampleViewController.m; sourceTree = "<group>"; };
+ 2428E8CC112375660019252F /* DTSnapGridViewExampleCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DTSnapGridViewExampleCellView.xib; sourceTree = "<group>"; };
+ 2428E8CD112375660019252F /* DTSnapGridViewExampleView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DTSnapGridViewExampleView.xib; sourceTree = "<group>"; };
+ 2428E8CE112375660019252F /* DTSnapGridViewExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTSnapGridViewExampleViewController.h; sourceTree = "<group>"; };
+ 2428E8CF112375660019252F /* DTSnapGridViewExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTSnapGridViewExampleViewController.m; sourceTree = "<group>"; };
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 32CA4F630368D1EE00C91783 /* DTGridView_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTGridView_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* DTGridView-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "DTGridView-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 080E96DDFE201D6D7F000001 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ 1D3623240D0F684500981E51 /* DTGridViewAppDelegate.h */,
+ 1D3623250D0F684500981E51 /* DTGridViewAppDelegate.m */,
+ 2428E8C8112375660019252F /* DTGridViewExampleDataSourceAndDelegate.h */,
+ 2428E8C9112375660019252F /* DTGridViewExampleDataSourceAndDelegate.m */,
+ 2428E8CA112375660019252F /* DTInfiniteGridViewExampleViewController.h */,
+ 2428E8CB112375660019252F /* DTInfiniteGridViewExampleViewController.m */,
+ 2428E8CC112375660019252F /* DTSnapGridViewExampleCellView.xib */,
+ 2428E8CD112375660019252F /* DTSnapGridViewExampleView.xib */,
+ 2428E8CE112375660019252F /* DTSnapGridViewExampleViewController.h */,
+ 2428E8CF112375660019252F /* DTSnapGridViewExampleViewController.m */,
+ );
+ path = Classes;
+ sourceTree = "<group>";
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 1D6058910D05DD3D006BFB54 /* DTGridView.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 2428E89B112374BF0019252F /* DTGridView */ = {
+ isa = PBXGroup;
+ children = (
+ 2428E89C112374BF0019252F /* DTGridView.h */,
+ 2428E89D112374BF0019252F /* DTGridView.m */,
+ 2428E89F112374BF0019252F /* DTGridViewCell.h */,
+ 2428E8A0112374BF0019252F /* DTGridViewCell.m */,
+ 2428E8A1112374BF0019252F /* DTGridViewCellInfoProtocol.h */,
+ 2428E8A2112374BF0019252F /* DTGridViewController.h */,
+ 2428E8A3112374BF0019252F /* DTGridViewController.m */,
+ );
+ path = DTGridView;
+ sourceTree = "<group>";
+ };
+ 2428E8AA112374E00019252F /* DTSnapGridView */ = {
+ isa = PBXGroup;
+ children = (
+ 2428E8AB112374E00019252F /* DTLabelsSnapGridViewCell.h */,
+ 2428E8AC112374E00019252F /* DTLabelsSnapGridViewCell.m */,
+ 2428E8AD112374E00019252F /* DTSnapGridView.h */,
+ 2428E8AE112374E00019252F /* DTSnapGridView.m */,
+ 2428E8AF112374E00019252F /* DTSnapGridViewCell.h */,
+ 2428E8B0112374E00019252F /* DTSnapGridViewCell.m */,
+ );
+ path = DTSnapGridView;
+ sourceTree = "<group>";
+ };
+ 2428E8B4112374E90019252F /* DTInfiniteGridView */ = {
+ isa = PBXGroup;
+ children = (
+ 2428E8B5112374E90019252F /* DTInfiniteGridView.h */,
+ 2428E8B6112374E90019252F /* DTInfiniteGridView.m */,
+ );
+ path = DTInfiniteGridView;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 2428E89B112374BF0019252F /* DTGridView */,
+ 2428E8AA112374E00019252F /* DTSnapGridView */,
+ 2428E8B4112374E90019252F /* DTInfiniteGridView */,
+ 080E96DDFE201D6D7F000001 /* Classes */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 32CA4F630368D1EE00C91783 /* DTGridView_Prefix.pch */,
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ );
+ name = "Other Sources";
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 28AD733E0D9D9553002E5188 /* MainWindow.xib */,
+ 8D1107310486CEB800E47090 /* DTGridView-Info.plist */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1D6058900D05DD3D006BFB54 /* DTGridView */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "DTGridView" */;
+ buildPhases = (
+ 1D60588D0D05DD3D006BFB54 /* Resources */,
+ 1D60588E0D05DD3D006BFB54 /* Sources */,
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = DTGridView;
+ productName = DTGridView;
+ productReference = 1D6058910D05DD3D006BFB54 /* DTGridView.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DTGridView" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1D6058900D05DD3D006BFB54 /* DTGridView */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1D60588D0D05DD3D006BFB54 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
+ 2428E8D2112375660019252F /* DTSnapGridViewExampleCellView.xib in Resources */,
+ 2428E8D3112375660019252F /* DTSnapGridViewExampleView.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1D60588E0D05DD3D006BFB54 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
+ 1D3623260D0F684500981E51 /* DTGridViewAppDelegate.m in Sources */,
+ 2428E8A5112374BF0019252F /* DTGridView.m in Sources */,
+ 2428E8A7112374BF0019252F /* DTGridViewCell.m in Sources */,
+ 2428E8A8112374BF0019252F /* DTGridViewController.m in Sources */,
+ 2428E8B1112374E00019252F /* DTLabelsSnapGridViewCell.m in Sources */,
+ 2428E8B2112374E00019252F /* DTSnapGridView.m in Sources */,
+ 2428E8B3112374E00019252F /* DTSnapGridViewCell.m in Sources */,
+ 2428E8B7112374E90019252F /* DTInfiniteGridView.m in Sources */,
+ 2428E8D0112375660019252F /* DTGridViewExampleDataSourceAndDelegate.m in Sources */,
+ 2428E8D1112375660019252F /* DTInfiniteGridViewExampleViewController.m in Sources */,
+ 2428E8D4112375660019252F /* DTSnapGridViewExampleViewController.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 1D6058940D05DD3E006BFB54 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = DTGridView_Prefix.pch;
+ INFOPLIST_FILE = "DTGridView-Info.plist";
+ PRODUCT_NAME = DTGridView;
+ };
+ name = Debug;
+ };
+ 1D6058950D05DD3E006BFB54 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = DTGridView_Prefix.pch;
+ INFOPLIST_FILE = "DTGridView-Info.plist";
+ PRODUCT_NAME = DTGridView;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = iphoneos3.1.2;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = iphoneos3.1.2;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "DTGridView" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1D6058940D05DD3E006BFB54 /* Debug */,
+ 1D6058950D05DD3E006BFB54 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DTGridView" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
198 DTGridView/DTGridView.h
@@ -0,0 +1,198 @@
+//
+// DTGridView.h
+// GridViewTester
+//
+// Created by Daniel Tull on 05.12.2008.
+// Copyright 2008 Daniel Tull. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "DTGridViewCell.h"
+
+/*!
+ @enum DTGridViewScrollPosition
+ @abstract Used to determine how to position a grid view cell on screen when scrolling to it.
+ @constant DTGridViewScrollPositionNone Aligns the cell such that the shortest distance to display as much of the cell is used.
+ @constant DTGridViewScrollPositionTopLeft Aligns the cell so that it is in the top left of the grid view.
+ @constant DTGridViewScrollPositionTopCenter Aligns the cell so that it is in the top center of the grid view.
+ @constant DTGridViewScrollPositionTopRight Aligns the cell so that it is in the top right of the grid view.
+ @constant DTGridViewScrollPositionMiddleLeft Aligns the cell so that it is in the middle left of the grid view.
+ @constant DTGridViewScrollPositionMiddleCenter Aligns the cell so that it is in the middle center of the grid view.
+ @constant DTGridViewScrollPositionMiddleRight Aligns the cell so that it is in the middle right of the grid view.
+ @constant DTGridViewScrollPositionBottomLeft Aligns the cell so that it is in the bottom left of the grid view.
+ @constant DTGridViewScrollPositionBottomCenter Aligns the cell so that it is in the bottom center of the grid view.
+ @constant DTGridViewScrollPositionBottomRight Aligns the cell so that it is in the bottom right of the grid view.
+ @discussion In most cases you will want to use DTGridViewScrollPositionNone to just bring the cell to the screen using the quickest route. In the case where the cell is too big to display completely on screen, the position will still be used, in that the center aligned cells will have their middle in the center of the screen, with their edges outside the screen bounds equally as much.
+*/
+typedef enum {
+ DTGridViewScrollPositionNone = 0,
+ DTGridViewScrollPositionTopLeft,
+ DTGridViewScrollPositionTopCenter,
+ DTGridViewScrollPositionTopRight,
+ DTGridViewScrollPositionMiddleLeft,
+ DTGridViewScrollPositionMiddleCenter,
+ DTGridViewScrollPositionMiddleRight,
+ DTGridViewScrollPositionBottomLeft,
+ DTGridViewScrollPositionBottomCenter,
+ DTGridViewScrollPositionBottomRight
+} DTGridViewScrollPosition;
+
+/*!
+ @enum DTGridViewEdge
+ @abstract Categorizes beverages into groups of similar types.
+ @constant DTGridViewEdgeTop Sweet, carbonated, non-alcoholic beverages.
+ @constant DTGridViewEdgeBottom Sweet, carbonated, non-alcoholic beverages.
+ @constant DTGridViewEdgeLeft Sweet, carbonated, non-alcoholic beverages.
+ @constant DTGridViewEdgeRight Sweet, carbonated, non-alcoholic beverages.
+ @discussion Extended discussion goes here.
+ Lorem ipsum....
+*/
+typedef enum {
+ DTGridViewEdgeTop,
+ DTGridViewEdgeBottom,
+ DTGridViewEdgeLeft,
+ DTGridViewEdgeRight
+} DTGridViewEdge;
+
+struct DTOutset {
+ CGFloat top;
+ CGFloat bottom;
+ CGFloat left;
+ CGFloat right;
+};
+
+@protocol DTGridViewDelegate;
+@protocol DTGridViewDataSource;
+
+
+/*!
+ @class DTGridView
+ @abstract
+ @discussion
+*/
+@interface DTGridView : UIScrollView <UIScrollViewDelegate, DTGridViewCellDelegate> {
+
+ NSObject<DTGridViewDelegate> *gridDelegate;
+ NSObject<DTGridViewDataSource> *dataSource;
+
+ CGPoint cellOffset;
+
+ UIEdgeInsets outset;
+
+ NSMutableArray *gridCells;
+
+ NSMutableArray *freeCells;
+ NSMutableArray *cellInfoForCellsOnScreen;
+
+ NSMutableArray *gridRows;
+ NSMutableArray *rowHeights;
+ NSMutableArray *rowPositions;
+
+ NSMutableArray *cellsOnScreen;
+
+ CGPoint oldContentOffset;
+
+ BOOL hasLoadedData;
+
+ NSInteger numberOfRows;
+
+ NSInteger rowIndexOfSelectedCell;
+ NSInteger columnIndexOfSelectedCell;
+}
+
+/*!
+ @abstract The object that acts as the data source of the receiving grid view.
+ @discussion The data source must adopt the DTGridViewDataSource protocol. The data source is not retained.
+*/
+@property (nonatomic, assign) IBOutlet NSObject<DTGridViewDataSource> *dataSource;
+
+/*!
+ @abstract The object that acts as the delegate of the receiving grid view.
+ @discussion The delegate must adopt the DTGridViewDelegate protocol. The delegate is not retained.
+*/
+@property (nonatomic, assign) IBOutlet NSObject<DTGridViewDelegate> *gridDelegate;
+
+/*!
+ @abstract The offset for each cell with respect to the cells above and to the right.
+ @discussion The x and y values can be either positive or negative; Using negative will overlay the cells by that amount, the outcome of this can never be gauranteed what the ordering of cells will be though.
+*/
+@property (assign) CGPoint cellOffset;
+@property (assign) UIEdgeInsets outset;
+@property (nonatomic, retain) NSMutableArray *gridCells;
+@property (nonatomic) NSInteger numberOfRows;
+
+- (CGFloat)findWidthForRow:(NSInteger)row column:(NSInteger)column;
+- (NSInteger)findNumberOfRows;
+- (NSInteger)findNumberOfColumnsForRow:(NSInteger)row;
+- (CGFloat)findHeightForRow:(NSInteger)row;
+- (DTGridViewCell *)findViewForRow:(NSInteger)row column:(NSInteger)column;
+
+/*!
+ @abstract Returns a reusable grid view cell object located by its identifier.
+ @param identifier A string identifying the cell object to be reused.
+ @discussion For performance reasons, grid views should always reuse their cells. This works like the table view's reuse policy.
+*/
+- (DTGridViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier;
+
+/*!
+ @abstract A constant that identifies a relative position in the receiving table view (top, middle, bottom) for row when scrolling concludes. See “Table View Scroll Position” a descriptions of valid constants.
+ @param rowIndex The index of the row to scroll to.
+ @param columnIndex The index of the column to scroll to.
+ @param position The position the cell should be in once scrolled to.
+ @param animated If this
+*/
+- (void)scrollViewToRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated;
+
+- (void)selectRow:(NSInteger)rowIndex column:(NSInteger)columnIndex scrollPosition:(DTGridViewScrollPosition)position animated:(BOOL)animated;
+
+/*!
+ @abstract This method should be used by subclasses to know when the grid did appear on screen.
+*/
+- (void)didLoad;
+
+/*!
+ @abstract Call this to reload the grid view's data.
+*/
+- (void)reloadData;
+
+- (void)positionCheck;
+
+@end
+
+@protocol DTGridViewDelegate <UIScrollViewDelegate>
+
+@optional
+/*!
+ Called when the grid view loads.
+ */
+- (void)gridViewDidLoad:(DTGridView *)gridView;
+- (void)gridView:(DTGridView *)gridView selectionMadeAtRow:(NSInteger)rowIndex column:(NSInteger)columnIndex;
+- (void)gridView:(DTGridView *)gridView scrolledToEdge:(DTGridViewEdge)edge;
+- (void)pagedGridView:(DTGridView *)gridView didScrollToRow:(NSInteger)rowIndex column:(NSInteger)columnIndex;
+- (void)gridView:(DTGridView *)gridView didProgrammaticallyScrollToRow:(NSInteger)rowIndex column:(NSInteger)columnIndex;
+@end
+
+
+@protocol DTGridViewDataSource
+/*!
+ Asks the data source to return the number of rows in the grid view.
+The grid view object requesting this information.
+ @return The number of rows in the grid view.
+ */
+- (NSInteger)numberOfRowsInGridView:(DTGridView *)gridView;
+/*!
+ @abstract Asks the data source to return the number of columns for the given row in the grid view.
+ @para The grid view object requesting this information.
+ @para The index of the given row.
+ @return The number of colums in the row of the grid view.
+ */
+- (NSInteger)numberOfColumnsInGridView:(DTGridView *)gridView forRowWithIndex:(NSInteger)index;
+- (CGFloat)gridView:(DTGridView *)gridView heightForRow:(NSInteger)rowIndex;
+- (CGFloat)gridView:(DTGridView *)gridView widthForCellAtRow:(NSInteger)rowIndex column:(NSInteger)columnIndex;
+- (DTGridViewCell *)gridView:(DTGridView *)gridView viewForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex;
+
+@optional
+- (NSInteger)spacingBetweenRowsInGridView:(DTGridView *)gridView;
+- (NSInteger)spacingBetweenColumnsInGridView:(DTGridView *)gridView;
+
+@end
732 DTGridView/DTGridView.m
@@ -0,0 +1,732 @@
+//
+// DTGridView.m
+// GridViewTester
+//
+// Created by Daniel Tull on 05.12.2008.
+// Copyright 2008 Daniel Tull. All rights reserved.
+//
+
+#import "DTGridView.h"
+#import "DTGridViewCellInfoProtocol.h"
+
+@interface DTGridViewCellInfo : NSObject <DTGridViewCellInfoProtocol> {
+ NSInteger xPosition, yPosition;
+ CGRect frame;
+ CGFloat x, y, width, height;
+}
+@property (nonatomic, assign) CGFloat x, y, width, height;
+@end
+
+@implementation DTGridViewCellInfo
+@synthesize xPosition, yPosition, x, y, width, height, frame;
+- (NSString *)description {
+ return [NSString stringWithFormat:@"DTGridViewCellInfo: frame=(%i %i; %i %i) x=%i, y=%i", (NSInteger)self.frame.origin.x, (NSInteger)self.frame.origin.y, (NSInteger)self.frame.size.width, (NSInteger)self.frame.size.height, self.xPosition, self.yPosition];
+}
+@end
+
+@interface DTGridView ()
+- (void)loadData;
+- (void)checkViews;
+- (void)initialiseViews;
+- (void)fireEdgeScroll;
+- (void)checkNewRowStartingWithCellInfo:(NSObject<DTGridViewCellInfoProtocol> *)info goingUp:(BOOL)goingUp;
+- (NSObject<DTGridViewCellInfoProtocol> *)cellInfoForRow:(NSInteger)row column:(NSInteger)col;
+- (void)checkRow:(NSInteger)row column:(NSInteger)col goingLeft:(BOOL)goingLeft;
+@end
+
+@implementation DTGridView
+
+@synthesize dataSource, gridCells, numberOfRows, cellOffset, gridDelegate, outset;
+
+NSInteger intSort(id info1, id info2, void *context) {
+
+ DTGridViewCellInfo *i1 = (DTGridViewCellInfo *)info1;
+ DTGridViewCellInfo *i2 = (DTGridViewCellInfo *)info2;
+
+ if (i1.yPosition < i2.yPosition)
+ return NSOrderedAscending;
+ else if (i1.yPosition > i2.yPosition)
+ return NSOrderedDescending;
+ else if (i1.xPosition < i2.xPosition)
+ return NSOrderedAscending;
+ else if (i1.xPosition > i2.xPosition)
+ return NSOrderedDescending;
+ else
+ return NSOrderedSame;
+}
+
+- (id)delegate {
+ return self;
+}
+
+- (void)reloadData {
+ [self loadData];
+ [self setNeedsDisplay];
+}
+
+- (void)drawRect:(CGRect)rect {
+ columnIndexOfSelectedCell = -1;
+ rowIndexOfSelectedCell = -1;
+
+ oldContentOffset = CGPointMake(0.0, 0.0);
+ gridRows = [[NSMutableArray alloc] init];
+ rowPositions = [[NSMutableArray alloc] init];
+ rowHeights = [[NSMutableArray alloc] init];
+ cellsOnScreen = [[NSMutableArray alloc] init];
+
+ super.delegate = self;
+
+ freeCells = [[NSMutableArray alloc] init];
+
+ cellInfoForCellsOnScreen = [[NSMutableArray alloc] init];
+
+ //hasLoadedData = NO;
+
+ //if (!hasLoadedData)
+
+ [self loadData];
+
+ for (UIView *v in self.subviews)
+ [v removeFromSuperview];
+
+ [self initialiseViews];
+
+ [self didLoad];
+}
+
+- (void)didLoad {
+ if ([self.gridDelegate respondsToSelector:@selector(gridViewDidLoad:)])
+ [self.gridDelegate gridViewDidLoad:self];
+}
+
+- (void)layoutSubviews {
+ [super layoutSubviews];
+ [self checkViews];
+}
+
+- (void)dealloc {
+ super.delegate = nil;
+ self.dataSource = nil;
+ [cellsOnScreen release];
+ [gridRows release];
+ [rowPositions release];
+ [rowHeights release];
+ [super dealloc];
+}
+
+#pragma mark Adding and Removing Cells
+
+- (void)addCellWithInfo:(NSObject<DTGridViewCellInfoProtocol> *)info {
+
+ if (![info isMemberOfClass:[DTGridViewCellInfo class]]) return;
+
+ [cellInfoForCellsOnScreen addObject:info];
+
+ [cellInfoForCellsOnScreen sortUsingFunction:intSort context:NULL];
+
+ DTGridViewCell *cell = [[self findViewForRow:info.yPosition column:info.xPosition] retain];
+ [cell setNeedsDisplay];
+ cell.xPosition = info.xPosition;
+ cell.yPosition = info.yPosition;
+ cell.delegate = self;
+ cell.frame = info.frame;
+
+ if (cell.xPosition == columnIndexOfSelectedCell && cell.yPosition == rowIndexOfSelectedCell)
+ cell.selected = YES;
+ else
+ cell.selected = NO;
+
+ [[gridCells objectAtIndex:info.yPosition] replaceObjectAtIndex:info.xPosition withObject:cell];
+
+ [self insertSubview:cell atIndex:0];
+ [cell release];
+
+}
+
+- (void)removeCellWithInfo:(DTGridViewCellInfo *)info {
+
+
+
+ if (info.yPosition > [gridCells count]) return;
+
+ NSMutableArray *row = [gridCells objectAtIndex:info.yPosition];
+
+ if (info.xPosition > [row count]) return;
+
+ DTGridViewCell *cell = [row objectAtIndex:info.xPosition];
+
+ if (![cell isKindOfClass:[DTGridViewCell class]]) return;
+
+ [cell retain];
+
+ [cell removeFromSuperview];
+
+ [row replaceObjectAtIndex:info.xPosition withObject:info];
+
+ [cellInfoForCellsOnScreen removeObject:info];
+
+ // TODO: Should this be set?
+ //cell.frame = CGRectZero;
+
+ [freeCells addObject:cell];
+
+ [cell release];
+}
+
+- (BOOL)cellInfoShouldBeOnShow:(NSObject<DTGridViewCellInfoProtocol> *)info {
+
+ if (!info || ![info isMemberOfClass:[DTGridViewCellInfo class]]) return NO;
+
+ return (!(info.frame.origin.x + info.frame.size.width < self.contentOffset.x
+ || info.frame.origin.y + info.frame.size.height < self.contentOffset.y
+ || info.frame.origin.x > self.contentOffset.x + self.frame.size.width
+ || info.frame.origin.y > self.contentOffset.y + self.frame.size.height));
+}
+
+#pragma mark -
+#pragma mark Finding Infomation from DataSource
+
+- (CGFloat)findWidthForRow:(NSInteger)row column:(NSInteger)column {
+ return [self.dataSource gridView:self widthForCellAtRow:row column:column];
+}
+
+- (NSInteger)findNumberOfRows {
+ return [self.dataSource numberOfRowsInGridView:self];
+}
+
+- (NSInteger)findNumberOfColumnsForRow:(NSInteger)row {
+ return [self.dataSource numberOfColumnsInGridView:self forRowWithIndex:row];
+}
+
+- (CGFloat)findHeightForRow:(NSInteger)row {
+ return [self.dataSource gridView:self heightForRow:row];
+}
+
+- (DTGridViewCell *)findViewForRow:(NSInteger)row column:(NSInteger)column {
+ return [self.dataSource gridView:self viewForRow:row column:column];
+}
+#pragma mark -
+
+- (void)loadData {
+
+ hasLoadedData = YES;
+
+ if (![self.dataSource respondsToSelector:@selector(numberOfRowsInGridView:)])
+ return;
+
+ self.numberOfRows = [self findNumberOfRows];
+
+ if (!self.numberOfRows)
+ return;
+
+ [gridRows removeAllObjects];
+ [rowHeights removeAllObjects];
+ [rowPositions removeAllObjects];
+
+ NSMutableArray *cellInfoArrayRows = [[NSMutableArray alloc] init];
+
+ CGFloat maxHeight;
+ CGFloat maxWidth;
+
+
+ for (NSInteger i = 0; i < self.numberOfRows; i++) {
+
+ NSInteger numberOfCols = [self findNumberOfColumnsForRow:i];
+
+ NSMutableArray *cellInfoArrayCols = [[NSMutableArray alloc] init];
+
+ for (NSInteger j = 0; j < numberOfCols; j++) {
+
+
+ DTGridViewCellInfo *info = [[DTGridViewCellInfo alloc] init];
+
+ info.xPosition = j;
+ info.yPosition = i;
+
+
+ CGFloat height = [self findHeightForRow:i];
+ CGFloat width = [self findWidthForRow:i column:j];
+
+ //info.frame.size.height = [dataSource gridView:self heightForRow:i];
+ //info.frame.size.width = [dataSource gridView:self widthForCellAtRow:i column:j];
+ CGFloat y;
+ CGFloat x;
+
+ if (i == 0) {
+ y = 0.0;
+ //info.frame.origin.y = 0.0;
+ } else {
+ DTGridViewCellInfo *previousCellRow = [[cellInfoArrayRows objectAtIndex:i-1] objectAtIndex:0];
+ y = previousCellRow.frame.origin.y + previousCellRow.frame.size.height;
+
+ if (cellOffset.y != 0)
+ y += cellOffset.y;
+ }
+
+ if (j == 0) {
+ x = 0.0;
+ } else {
+ DTGridViewCellInfo *previousCellRow = [cellInfoArrayCols objectAtIndex:j-1];
+ x = previousCellRow.frame.origin.x + previousCellRow.frame.size.width;
+ if (cellOffset.x != 0)
+ x += cellOffset.x;
+ }
+
+ if (maxHeight < y + height)
+ maxHeight = y + height;
+
+ if (maxWidth < x + width)
+ maxWidth = x + width;
+
+ info.frame = CGRectMake(x,y,width,height);
+
+ [cellInfoArrayCols addObject:info];
+
+ [info release];
+ }
+
+ [cellInfoArrayRows addObject:cellInfoArrayCols];
+ [cellInfoArrayCols release];
+ }
+
+
+ self.contentSize = CGSizeMake(maxWidth, maxHeight);
+
+ self.gridCells = cellInfoArrayRows;
+ [cellInfoArrayRows release];
+
+}
+
+- (void)checkViews {
+
+ if ([cellInfoForCellsOnScreen count] == 0) {
+ [self initialiseViews];
+ return;
+ }
+
+ NSMutableDictionary *leftRightCells = [[NSMutableDictionary alloc] init];
+
+ NSArray *orderedCells = [cellInfoForCellsOnScreen copy];
+
+ BOOL isGoingUp = NO;
+ BOOL isGoingDown = NO;
+ BOOL isGoingLeft = NO;
+ BOOL isGoingRight = NO;
+
+ if (self.contentOffset.y < oldContentOffset.y && self.contentOffset.y >= 0)
+ isGoingUp = YES;
+ else if (self.contentOffset.y > oldContentOffset.y && self.contentOffset.y + self.frame.size.height < self.contentSize.height)
+ isGoingDown = YES;
+
+ if (self.contentOffset.x < oldContentOffset.x && self.contentOffset.x >= 0)
+ isGoingLeft = YES;
+ else if (self.contentOffset.x > oldContentOffset.x && self.contentOffset.x + self.frame.size.width < self.contentSize.width)
+ isGoingRight = YES;
+
+ oldContentOffset = self.contentOffset;
+
+ for (DTGridViewCellInfo *info in orderedCells) {
+
+ if (isGoingLeft){
+ if (info.xPosition > 0 && info.frame.origin.x > self.contentOffset.x)
+ if (![leftRightCells objectForKey:[NSString stringWithFormat:@"%i", info.yPosition]])
+ [leftRightCells setObject:info forKey:[NSString stringWithFormat:@"%i", info.yPosition]];
+ else if ([[leftRightCells objectForKey:[NSString stringWithFormat:@"%i", info.yPosition]] xPosition] > info.xPosition)
+ [leftRightCells setObject:info forKey:[NSString stringWithFormat:@"%i", info.yPosition]];
+
+ } else if (isGoingRight) {
+ if ([[self.gridCells objectAtIndex:info.yPosition] count] - 1 > info.xPosition && info.frame.origin.x + info.frame.size.width < self.contentOffset.x + self.frame.size.width)
+ if (![leftRightCells objectForKey:[NSString stringWithFormat:@"%i", info.yPosition]])
+ [leftRightCells setObject:info forKey:[NSString stringWithFormat:@"%i", info.yPosition]];
+ else if ([[leftRightCells objectForKey:[NSString stringWithFormat:@"%i", info.yPosition]] xPosition] < info.xPosition)
+ [leftRightCells setObject:info forKey:[NSString stringWithFormat:@"%i", info.yPosition]];
+ }
+
+ if (![self cellInfoShouldBeOnShow:info])
+ [self removeCellWithInfo:info];
+
+ }
+
+ if (isGoingLeft) {
+ for (NSString *yPos in [leftRightCells allKeys]) {
+ DTGridViewCellInfo *info = [leftRightCells objectForKey:yPos];
+ [self checkRow:info.yPosition column:info.xPosition goingLeft:YES];
+ }
+
+ } else if (isGoingRight) {
+ for (NSString *yPos in [leftRightCells allKeys]) {
+ DTGridViewCellInfo *info = [leftRightCells objectForKey:yPos];
+ [self checkRow:info.yPosition column:info.xPosition goingLeft:NO];
+ }
+ }
+
+ if (isGoingUp)
+ [self checkNewRowStartingWithCellInfo:[orderedCells objectAtIndex:0] goingUp:YES];
+ else if (isGoingDown)
+ [self checkNewRowStartingWithCellInfo:[orderedCells lastObject] goingUp:NO];
+
+
+ [leftRightCells release];
+ [orderedCells release];
+}
+
+- (void)initialiseViews {
+
+ for (NSInteger i = 0; i < [cellInfoForCellsOnScreen count]; i++) {
+
+ DTGridViewCellInfo *info = [cellInfoForCellsOnScreen objectAtIndex:i];
+
+ if (![self cellInfoShouldBeOnShow:info])
+ [self removeCellWithInfo:info];
+
+ }
+
+ for (NSInteger i = 0; i < [gridCells count]; i++) {
+
+ NSMutableArray *row = [gridCells objectAtIndex:i];
+
+ for (NSInteger j = 0; j < [row count]; j++) {
+
+ id object = [row objectAtIndex:j];
+
+ if ([object isMemberOfClass:[DTGridViewCellInfo class]]) {
+
+ DTGridViewCellInfo *info = (DTGridViewCellInfo *)object;
+
+ if ([self cellInfoShouldBeOnShow:info])
+ [self addCellWithInfo:info];
+
+ }
+ }
+ }
+}
+
+- (void)checkRow:(NSInteger)row column:(NSInteger)col goingLeft:(BOOL)goingLeft {
+
+ NSObject<DTGridViewCellInfoProtocol> *info = [self cellInfoForRow:row column:col];
+
+ if (!info) return;
+
+ if ([self cellInfoShouldBeOnShow:info])
+ [self addCellWithInfo:info];
+
+ if (goingLeft) {
+ if (info.frame.origin.x > self.contentOffset.x)
+ [self checkRow:row column:(col - 1) goingLeft:goingLeft];
+ } else {
+ if (info.frame.origin.x + info.frame.size.width < self.contentOffset.x + self.frame.size.width)