Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 109 lines (80 sloc) 3.469 kb
a224b79 Daniel Tull Initial commit. Split out from DTKit.
authored
1 //
2 // DTGridViewAppDelegate.m
3 // DTGridView
4 //
5 // Created by Daniel Tull on 10.02.2010.
6 // Copyright Daniel Tull 2010. All rights reserved.
7 //
8
9 #import "DTGridViewAppDelegate.h"
ca30030 Daniel Tull Hooked up the table to show the GridView examples.
authored
10 #import "DTGridViewExampleDataSourceAndDelegate.h"
11 #import "DTInfiniteGridViewExampleViewController.h"
12 #import "DTSnapGridViewExampleViewController.h"
13 #import "DTLicenseAgreementViewController.h"
a224b79 Daniel Tull Initial commit. Split out from DTKit.
authored
14 @implementation DTGridViewAppDelegate
15
16 @synthesize window;
17
18
19 - (void)applicationDidFinishLaunching:(UIApplication *)application {
ca30030 Daniel Tull Hooked up the table to show the GridView examples.
authored
20
21 UITableViewController *vc = [[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped];
22
23 navigationController = [[UINavigationController alloc] initWithRootViewController:vc];
24
25 vc.title = @"DTGridView";
26 vc.tableView.delegate = self;
27 vc.tableView.dataSource = self;
28 [vc release];
29
30 [window addSubview:navigationController.view];
31
a224b79 Daniel Tull Initial commit. Split out from DTKit.
authored
32 // Override point for customization after application launch
33 [window makeKeyAndVisible];
34 }
35
36
37 - (void)dealloc {
ca30030 Daniel Tull Hooked up the table to show the GridView examples.
authored
38 [navigationController release];
a224b79 Daniel Tull Initial commit. Split out from DTKit.
authored
39 [window release];
40 [super dealloc];
41 }
42
ca30030 Daniel Tull Hooked up the table to show the GridView examples.
authored
43 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
44 return 3;
45 }
46
47 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
48
49 if (section == 0) return 1;
50 if (section == 1) return 3;
51
52 return 0;
53 }
54
55 - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {
f1a708e Daniel Tull Added a mesage to encourage attribution.
authored
56 if (section == 0) return @"Please attribute me when using my source code by linking to my website. Thank you.";
57 if (section == 2) return @"©2008-2010 Daniel Tull\nwww.danieltull.co.uk";
58
59 return nil;
ca30030 Daniel Tull Hooked up the table to show the GridView examples.
authored
60 }
61
62 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
63
64 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
65
66 if (!cell)
6fea514 James Montgomerie Fix compiler warnings with 5.0 SDK.
th-in-gs authored
67 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"] autorelease];
ca30030 Daniel Tull Hooked up the table to show the GridView examples.
authored
68
69 cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
70
71 NSString *cellText = nil;
72
73 if (indexPath.section == 0 && indexPath.row == 0)
74 cellText = @"Source License";
75 else if (indexPath.section == 1 && indexPath.row == 0)
76 cellText = @"DTGridView";
77 else if (indexPath.section == 1 && indexPath.row == 1)
78 cellText = @"DTInfiniteGridView";
79 else if (indexPath.section == 1 && indexPath.row == 2)
80 cellText = @"DTSnapGridView";
81
82 cell.textLabel.text = cellText;
83
84 return cell;
85 }
86
87 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
88
89 if (indexPath.section == 0 && indexPath.row == 0) {
90 DTLicenseAgreementViewController *vc = [[DTLicenseAgreementViewController alloc] init];
91 [navigationController pushViewController:vc animated:YES];
92 [vc release];
93 } else if (indexPath.section == 1 && indexPath.row == 0) {
94 DTGridViewExampleDataSourceAndDelegate *vc = [[DTGridViewExampleDataSourceAndDelegate alloc] init];
95 [navigationController pushViewController:vc animated:YES];
96 [vc release];
97 } else if (indexPath.section == 1 && indexPath.row == 1) {
98 DTInfiniteGridViewExampleViewController *vc = [[DTInfiniteGridViewExampleViewController alloc] init];
99 [navigationController pushViewController:vc animated:YES];
100 [vc release];
101 } else if (indexPath.section == 1 && indexPath.row == 2) {
102 DTSnapGridViewExampleViewController *vc = [[DTSnapGridViewExampleViewController alloc] init];
103 [navigationController pushViewController:vc animated:YES];
104 [vc release];
105 }
106 }
a224b79 Daniel Tull Initial commit. Split out from DTKit.
authored
107
108 @end
Something went wrong with that request. Please try again.