RSS

(root)/iphone/common : 61 : Jigs/source/NewGameTableViewController.m

« back to all changes in this revision

Viewing changes to Jigs/source/NewGameTableViewController.m

Dömötör Gulyás
2010-01-18 09:03:51
Revision ID: dognotdog@gmail.com-20100118080351-ib2knxvk4w8ssw3h
made common a nested tree

Show diffs side-by-side

added added

removed removed

1
 
//
2
 
//  NewGameTableViewController.m
3
 
//  Jigs
4
 
//
5
 
//  Created by döme on 11.08.2009.
6
 
//  Copyright 2009 __MyCompanyName__. All rights reserved.
7
 
//
8
 
 
9
 
#import "NewGameTableViewController.h"
10
 
#import "JigsawViewController.h"
11
 
 
12
 
 
13
 
@implementation NewGameTableViewController
14
 
 
15
 
/*
16
 
- (id)initWithStyle:(UITableViewStyle)style {
17
 
    // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
18
 
    if (self = [super initWithStyle:style]) {
19
 
    }
20
 
    return self;
21
 
}
22
 
*/
23
 
 
24
 
/*
25
 
- (void)viewDidLoad {
26
 
    [super viewDidLoad];
27
 
 
28
 
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
29
 
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
30
 
}
31
 
*/
32
 
 
33
 
/*
34
 
- (void)viewWillAppear:(BOOL)animated {
35
 
    [super viewWillAppear:animated];
36
 
}
37
 
*/
38
 
/*
39
 
- (void)viewDidAppear:(BOOL)animated {
40
 
    [super viewDidAppear:animated];
41
 
}
42
 
*/
43
 
/*
44
 
- (void)viewWillDisappear:(BOOL)animated {
45
 
        [super viewWillDisappear:animated];
46
 
}
47
 
*/
48
 
/*
49
 
- (void)viewDidDisappear:(BOOL)animated {
50
 
        [super viewDidDisappear:animated];
51
 
}
52
 
*/
53
 
 
54
 
/*
55
 
// Override to allow orientations other than the default portrait orientation.
56
 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
57
 
    // Return YES for supported orientations
58
 
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
59
 
}
60
 
*/
61
 
 
62
 
- (void)didReceiveMemoryWarning {
63
 
        // Releases the view if it doesn't have a superview.
64
 
    [super didReceiveMemoryWarning];
65
 
        
66
 
        // Release any cached data, images, etc that aren't in use.
67
 
}
68
 
 
69
 
- (void)viewDidUnload {
70
 
        // Release any retained subviews of the main view.
71
 
        // e.g. self.myOutlet = nil;
72
 
}
73
 
 
74
 
- (void) awakeFromNib
75
 
{
76
 
        [super awakeFromNib];
77
 
        [self.tableView setAllowsSelection: NO];
78
 
}
79
 
 
80
 
#pragma mark Table view methods
81
 
 
82
 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
83
 
{
84
 
    return 2;
85
 
}
86
 
 
87
 
 
88
 
// Customize the number of rows in the table view.
89
 
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
90
 
{
91
 
        switch(section)
92
 
        {
93
 
                case 0:
94
 
                        return 1;
95
 
                case 1:
96
 
                        return 2;
97
 
        }
98
 
    return 0;
99
 
}
100
 
 
101
 
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
102
 
{
103
 
        switch (indexPath.section)
104
 
        {
105
 
                case 0:
106
 
                        return imageCell.bounds.size.height;
107
 
                        break;
108
 
                case 1:
109
 
                        switch (indexPath.row)
110
 
                        {
111
 
                                case 0:
112
 
                                        return sizeCell.bounds.size.height;
113
 
                                        break;
114
 
                                case 1:
115
 
                                        return rotationCell.bounds.size.height;
116
 
                                        break;
117
 
                        }
118
 
                        break;
119
 
        }
120
 
        return 0.0f;
121
 
}
122
 
 
123
 
// Customize the appearance of table view cells.
124
 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
125
 
{
126
 
        NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
127
 
 
128
 
        switch (indexPath.section)
129
 
        {
130
 
                case 0:
131
 
                {
132
 
                        //[imageWell setImage: [UIImage imageWithData: [defaults objectForKey: NewJigsawImageKey]]];
133
 
                        return imageCell;
134
 
                        break;
135
 
                }
136
 
                case 1:
137
 
                        switch (indexPath.row)
138
 
                        {
139
 
                                case 0:
140
 
                                        //[sizeSlider setValue: [defaults floatForKey: NewJigsawDensityKey]];
141
 
                                        return sizeCell;
142
 
                                        break;
143
 
                                case 1:
144
 
                                        [rotationSwitch setOn: [defaults boolForKey: NewJigsawRotationEnabledKey]];
145
 
                                        return rotationCell;
146
 
                                        break;
147
 
                        }
148
 
                        break;
149
 
        }
150
 
        
151
 
    return nil;
152
 
}
153
 
 
154
 
 
155
 
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
156
 
    // Navigation logic may go here. Create and push another view controller.
157
 
        // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
158
 
        // [self.navigationController pushViewController:anotherViewController];
159
 
        // [anotherViewController release];
160
 
}
161
 
 
162
 
 
163
 
/*
164
 
// Override to support conditional editing of the table view.
165
 
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
166
 
    // Return NO if you do not want the specified item to be editable.
167
 
    return YES;
168
 
}
169
 
*/
170
 
 
171
 
 
172
 
/*
173
 
// Override to support editing the table view.
174
 
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
175
 
    
176
 
    if (editingStyle == UITableViewCellEditingStyleDelete) {
177
 
        // Delete the row from the data source
178
 
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
179
 
    }   
180
 
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
181
 
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
182
 
    }   
183
 
}
184
 
*/
185
 
 
186
 
 
187
 
/*
188
 
// Override to support rearranging the table view.
189
 
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
190
 
}
191
 
*/
192
 
 
193
 
 
194
 
/*
195
 
// Override to support conditional rearranging of the table view.
196
 
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
197
 
    // Return NO if you do not want the item to be re-orderable.
198
 
    return YES;
199
 
}
200
 
*/
201
 
 
202
 
- (IBAction) rotationChanged: (id) sender
203
 
{
204
 
        [[NSUserDefaults standardUserDefaults] setBool: [sender isOn] forKey: NewJigsawRotationEnabledKey];
205
 
}
206
 
 
207
 
- (void) imageWasSelectedInWell: (ImageWell*) well
208
 
{
209
 
        [[NSUserDefaults standardUserDefaults] setObject: UIImagePNGRepresentation([well image]) forKey: NewJigsawImageKey];
210
 
}
211
 
 
212
 
- (void)dealloc
213
 
{
214
 
    [super dealloc];
215
 
}
216
 
 
217
 
 
218
 
@end
219
 
 

Loggerhead 1.17 is a web-based interface for Bazaar branches