iCuke 0.4.12 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/app/AlertsViewController.h +59 -0
- data/app/AlertsViewController.m +341 -0
- data/app/AppDelegate.h +60 -0
- data/app/AppDelegate.m +101 -0
- data/app/ButtonsViewController.h +80 -0
- data/app/ButtonsViewController.m +448 -0
- data/app/Constants.h +58 -0
- data/app/ControlsViewController.h +72 -0
- data/app/ControlsViewController.m +379 -0
- data/app/ImagesViewController.h +62 -0
- data/app/ImagesViewController.m +137 -0
- data/app/{iCuke/iCuke-Info.plist → Info.plist} +4 -4
- data/app/MainViewController.h +57 -0
- data/app/MainViewController.m +262 -0
- data/app/Picker/CustomPickerDataSource.h +55 -0
- data/app/Picker/CustomPickerDataSource.m +135 -0
- data/app/Picker/CustomView.h +62 -0
- data/app/Picker/CustomView.m +119 -0
- data/app/PickerViewController.h +88 -0
- data/app/PickerViewController.m +402 -0
- data/app/Prefix.pch +5 -0
- data/app/ReadMe.txt +82 -0
- data/app/SearchBarController.h +58 -0
- data/app/SearchBarController.m +105 -0
- data/app/SegmentViewController.h +54 -0
- data/app/SegmentViewController.m +195 -0
- data/app/TextFieldController.h +67 -0
- data/app/TextFieldController.m +342 -0
- data/app/TextViewController.h +57 -0
- data/app/TextViewController.m +164 -0
- data/app/ToolbarViewController.h +74 -0
- data/app/ToolbarViewController.m +303 -0
- data/app/TransitionViewController.h +64 -0
- data/app/TransitionViewController.m +178 -0
- data/app/UICatalog.xcodeproj/project.pbxproj +615 -0
- data/app/WebViewController.h +57 -0
- data/app/WebViewController.m +173 -0
- data/app/en.lproj/AlertsViewController.xib +144 -0
- data/app/en.lproj/ButtonsViewController.xib +147 -0
- data/app/en.lproj/ControlsViewController.xib +147 -0
- data/app/en.lproj/ImagesViewController.xib +264 -0
- data/app/en.lproj/Localizable.strings +41 -0
- data/app/en.lproj/MainWindow.xib +306 -0
- data/app/en.lproj/PickerViewController.xib +415 -0
- data/app/en.lproj/SearchBarController.xib +142 -0
- data/app/en.lproj/SegmentViewController.xib +143 -0
- data/app/en.lproj/TextFieldController.xib +167 -0
- data/app/en.lproj/TextViewController.xib +149 -0
- data/app/en.lproj/ToolbarViewController.xib +491 -0
- data/app/en.lproj/TransitionViewController.xib +255 -0
- data/app/en.lproj/WebViewController.xib +141 -0
- data/app/images/12-6AM.png +0 -0
- data/app/images/12-6PM.png +0 -0
- data/app/images/6-12AM.png +0 -0
- data/app/images/6-12PM.png +0 -0
- data/app/images/Default.png +0 -0
- data/app/images/Icon.png +0 -0
- data/app/images/UIButton_custom.png +0 -0
- data/app/images/blueButton.png +0 -0
- data/app/images/orangeslide.png +0 -0
- data/app/images/scene1.jpg +0 -0
- data/app/images/scene2.jpg +0 -0
- data/app/images/scene3.jpg +0 -0
- data/app/images/scene4.jpg +0 -0
- data/app/images/scene5.jpg +0 -0
- data/app/images/segment_check.png +0 -0
- data/app/images/segment_search.png +0 -0
- data/app/images/segment_tools.png +0 -0
- data/app/images/slider_ball.png +0 -0
- data/app/images/whiteButton.png +0 -0
- data/app/images/yellowslide.png +0 -0
- data/app/main.m +58 -0
- data/ext/iCuke/DefaultsResponse.m +0 -1
- data/ext/iCuke/EventResponse.m +9 -1
- data/ext/iCuke/Rakefile +1 -1
- data/ext/iCuke/Recorder.h +3 -1
- data/ext/iCuke/Recorder.m +10 -5
- data/ext/iCuke/RecorderResponse.h +1 -0
- data/ext/iCuke/RecorderResponse.m +10 -1
- data/ext/iCuke/Viewer.m +5 -6
- data/ext/iCuke/iCukeHTTPServer.m +1 -1
- data/ext/iCuke/iCukeServer.m +24 -7
- data/ext/iCuke/libicuke.dylib +0 -0
- data/features/uicatalog.feature +20 -0
- data/iCuke.gemspec +81 -24
- data/lib/icuke/com.apple.Accessibility.plist +0 -0
- data/lib/icuke/core_ext.rb +26 -0
- data/lib/icuke/cucumber.rb +20 -12
- data/lib/icuke/headless.rb +55 -0
- data/lib/icuke/simulator.rb +7 -129
- data/lib/icuke/xcode.rb +136 -0
- metadata +82 -25
- data/app/iCuke/Classes/FlipsideView.h +0 -13
- data/app/iCuke/Classes/FlipsideView.m +0 -32
- data/app/iCuke/Classes/FlipsideViewController.h +0 -25
- data/app/iCuke/Classes/FlipsideViewController.m +0 -54
- data/app/iCuke/Classes/MainView.h +0 -15
- data/app/iCuke/Classes/MainView.m +0 -32
- data/app/iCuke/Classes/MainViewController.h +0 -16
- data/app/iCuke/Classes/MainViewController.m +0 -86
- data/app/iCuke/Classes/iCukeAppDelegate.h +0 -20
- data/app/iCuke/Classes/iCukeAppDelegate.m +0 -33
- data/app/iCuke/FlipsideView.xib +0 -444
- data/app/iCuke/MainView.xib +0 -520
- data/app/iCuke/MainWindow.xib +0 -355
- data/app/iCuke/SniffingView.h +0 -20
- data/app/iCuke/SniffingView.m +0 -191
- data/app/iCuke/iCuke.xcodeproj/project.pbxproj +0 -313
- data/app/iCuke/iCuke_Prefix.pch +0 -14
- data/app/iCuke/main.m +0 -16
- data/features/icuke.feature +0 -17
- /data/app/{iCuke/.gitignore → .gitignore} +0 -0
data/Rakefile
CHANGED
@@ -22,10 +22,10 @@ rescue LoadError
|
|
22
22
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
23
23
|
end
|
24
24
|
|
25
|
-
file 'app/
|
26
|
-
sh 'cd app
|
25
|
+
file 'app/build/Debug-iphonesimulator/UICatalog.app/UICatalog' do
|
26
|
+
sh 'cd app && xcodebuild -target UICatalog -configuration Debug -sdk iphonesimulator3.1.2'
|
27
27
|
end
|
28
|
-
task :app => 'app/
|
28
|
+
task :app => 'app/build/Debug-iphonesimulator/UICatalog.app/UICatalog'
|
29
29
|
task :features => :app
|
30
30
|
|
31
31
|
task :lib do
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.1
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/*
|
2
|
+
File: AlertsViewController.h
|
3
|
+
Abstract: The view controller for hosting various kinds of alerts and action sheets
|
4
|
+
Version: 2.6
|
5
|
+
|
6
|
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
7
|
+
Inc. ("Apple") in consideration of your agreement to the following
|
8
|
+
terms, and your use, installation, modification or redistribution of
|
9
|
+
this Apple software constitutes acceptance of these terms. If you do
|
10
|
+
not agree with these terms, please do not use, install, modify or
|
11
|
+
redistribute this Apple software.
|
12
|
+
|
13
|
+
In consideration of your agreement to abide by the following terms, and
|
14
|
+
subject to these terms, Apple grants you a personal, non-exclusive
|
15
|
+
license, under Apple's copyrights in this original Apple software (the
|
16
|
+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
17
|
+
Software, with or without modifications, in source and/or binary forms;
|
18
|
+
provided that if you redistribute the Apple Software in its entirety and
|
19
|
+
without modifications, you must retain this notice and the following
|
20
|
+
text and disclaimers in all such redistributions of the Apple Software.
|
21
|
+
Neither the name, trademarks, service marks or logos of Apple Inc. may
|
22
|
+
be used to endorse or promote products derived from the Apple Software
|
23
|
+
without specific prior written permission from Apple. Except as
|
24
|
+
expressly stated in this notice, no other rights or licenses, express or
|
25
|
+
implied, are granted by Apple herein, including but not limited to any
|
26
|
+
patent rights that may be infringed by your derivative works or by other
|
27
|
+
works in which the Apple Software may be incorporated.
|
28
|
+
|
29
|
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
30
|
+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
31
|
+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
32
|
+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
33
|
+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
34
|
+
|
35
|
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
36
|
+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
37
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
38
|
+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
39
|
+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
40
|
+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
41
|
+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
42
|
+
POSSIBILITY OF SUCH DAMAGE.
|
43
|
+
|
44
|
+
Copyright (C) 2009 Apple Inc. All Rights Reserved.
|
45
|
+
|
46
|
+
*/
|
47
|
+
|
48
|
+
#import <UIKit/UIKit.h>
|
49
|
+
|
50
|
+
@interface AlertsViewController : UITableViewController <UIAlertViewDelegate, // for UIAlertView
|
51
|
+
UIActionSheetDelegate > // for UIActionSheet
|
52
|
+
{
|
53
|
+
NSArray *dataSourceArray;
|
54
|
+
}
|
55
|
+
|
56
|
+
@property (nonatomic, retain) NSArray *dataSourceArray;
|
57
|
+
|
58
|
+
@end
|
59
|
+
|
@@ -0,0 +1,341 @@
|
|
1
|
+
/*
|
2
|
+
File: AlertsViewController.m
|
3
|
+
Abstract: The view controller for hosting various kinds of alerts and action sheets
|
4
|
+
Version: 2.6
|
5
|
+
|
6
|
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
7
|
+
Inc. ("Apple") in consideration of your agreement to the following
|
8
|
+
terms, and your use, installation, modification or redistribution of
|
9
|
+
this Apple software constitutes acceptance of these terms. If you do
|
10
|
+
not agree with these terms, please do not use, install, modify or
|
11
|
+
redistribute this Apple software.
|
12
|
+
|
13
|
+
In consideration of your agreement to abide by the following terms, and
|
14
|
+
subject to these terms, Apple grants you a personal, non-exclusive
|
15
|
+
license, under Apple's copyrights in this original Apple software (the
|
16
|
+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
17
|
+
Software, with or without modifications, in source and/or binary forms;
|
18
|
+
provided that if you redistribute the Apple Software in its entirety and
|
19
|
+
without modifications, you must retain this notice and the following
|
20
|
+
text and disclaimers in all such redistributions of the Apple Software.
|
21
|
+
Neither the name, trademarks, service marks or logos of Apple Inc. may
|
22
|
+
be used to endorse or promote products derived from the Apple Software
|
23
|
+
without specific prior written permission from Apple. Except as
|
24
|
+
expressly stated in this notice, no other rights or licenses, express or
|
25
|
+
implied, are granted by Apple herein, including but not limited to any
|
26
|
+
patent rights that may be infringed by your derivative works or by other
|
27
|
+
works in which the Apple Software may be incorporated.
|
28
|
+
|
29
|
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
30
|
+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
31
|
+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
32
|
+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
33
|
+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
34
|
+
|
35
|
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
36
|
+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
37
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
38
|
+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
39
|
+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
40
|
+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
41
|
+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
42
|
+
POSSIBILITY OF SUCH DAMAGE.
|
43
|
+
|
44
|
+
Copyright (C) 2009 Apple Inc. All Rights Reserved.
|
45
|
+
|
46
|
+
*/
|
47
|
+
|
48
|
+
#import "AlertsViewController.h"
|
49
|
+
|
50
|
+
static NSString *kSectionTitleKey = @"sectionTitleKey";
|
51
|
+
static NSString *kLabelKey = @"labelKey";
|
52
|
+
static NSString *kSourceKey = @"sourceKey";
|
53
|
+
|
54
|
+
enum AlertTableSections
|
55
|
+
{
|
56
|
+
kUIAction_Simple_Section = 0,
|
57
|
+
kUIAction_OKCancel_Section,
|
58
|
+
kUIAction_Custom_Section,
|
59
|
+
kUIAlert_Simple_Section,
|
60
|
+
kUIAlert_OKCancel_Section,
|
61
|
+
kUIAlert_Custom_Section,
|
62
|
+
};
|
63
|
+
|
64
|
+
@implementation AlertsViewController
|
65
|
+
|
66
|
+
@synthesize dataSourceArray;
|
67
|
+
|
68
|
+
- (void)dealloc
|
69
|
+
{
|
70
|
+
[dataSourceArray release];
|
71
|
+
|
72
|
+
[super dealloc];
|
73
|
+
}
|
74
|
+
|
75
|
+
- (void)viewDidLoad
|
76
|
+
{
|
77
|
+
[super viewDidLoad];
|
78
|
+
|
79
|
+
self.title = NSLocalizedString(@"AlertTitle", @"");
|
80
|
+
|
81
|
+
self.dataSourceArray = [NSArray arrayWithObjects:
|
82
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
83
|
+
@"UIActionSheet", kSectionTitleKey,
|
84
|
+
@"Show Simple", kLabelKey,
|
85
|
+
@"AlertsViewController.m - dialogSimpleAction", kSourceKey,
|
86
|
+
nil],
|
87
|
+
|
88
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
89
|
+
@"UIActionSheet", kSectionTitleKey,
|
90
|
+
@"Show OK-Cancel", kLabelKey,
|
91
|
+
@"AlertsViewController.m - dialogOKCancelAction", kSourceKey,
|
92
|
+
nil],
|
93
|
+
|
94
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
95
|
+
@"UIActionSheet", kSectionTitleKey,
|
96
|
+
@"Show Customized", kLabelKey,
|
97
|
+
@"AlertsViewController.m - dialogOtherAction", kSourceKey,
|
98
|
+
nil],
|
99
|
+
|
100
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
101
|
+
@"UIAlertView", kSectionTitleKey,
|
102
|
+
@"Show Simple", kLabelKey,
|
103
|
+
@"AlertsViewController.m - alertSimpleAction", kSourceKey,
|
104
|
+
nil],
|
105
|
+
|
106
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
107
|
+
@"UIAlertView", kSectionTitleKey,
|
108
|
+
@"Show OK-Cancel", kLabelKey,
|
109
|
+
@"AlertsViewController.m - alertOKCancelAction", kSourceKey,
|
110
|
+
nil],
|
111
|
+
|
112
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
113
|
+
@"UIAlertView", kSectionTitleKey,
|
114
|
+
@"Show Custom", kLabelKey,
|
115
|
+
@"AlertsViewController.m - alertOtherAction", kSourceKey,
|
116
|
+
nil],
|
117
|
+
nil];
|
118
|
+
}
|
119
|
+
|
120
|
+
// called after the view controller's view is released and set to nil.
|
121
|
+
// For example, a memory warning which causes the view to be purged. Not invoked as a result of -dealloc.
|
122
|
+
// So release any properties that are loaded in viewDidLoad or can be recreated lazily.
|
123
|
+
//
|
124
|
+
- (void)viewDidUnload
|
125
|
+
{
|
126
|
+
[super viewDidUnload];
|
127
|
+
|
128
|
+
self.dataSourceArray = nil; // this will release and set to nil
|
129
|
+
}
|
130
|
+
|
131
|
+
|
132
|
+
#pragma mark -
|
133
|
+
#pragma mark UIActionSheet
|
134
|
+
|
135
|
+
- (void)dialogSimpleAction
|
136
|
+
{
|
137
|
+
// open a dialog with just an OK button
|
138
|
+
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"UIActionSheet <title>"
|
139
|
+
delegate:self cancelButtonTitle:nil destructiveButtonTitle:@"OK" otherButtonTitles:nil];
|
140
|
+
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
|
141
|
+
[actionSheet showInView:self.view]; // show from our table view (pops up in the middle of the table)
|
142
|
+
[actionSheet release];
|
143
|
+
}
|
144
|
+
|
145
|
+
- (void)dialogOKCancelAction
|
146
|
+
{
|
147
|
+
// open a dialog with an OK and cancel button
|
148
|
+
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"UIActionSheet <title>"
|
149
|
+
delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"OK" otherButtonTitles:nil];
|
150
|
+
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
|
151
|
+
[actionSheet showInView:self.view]; // show from our table view (pops up in the middle of the table)
|
152
|
+
[actionSheet release];
|
153
|
+
}
|
154
|
+
|
155
|
+
- (void)dialogOtherAction
|
156
|
+
{
|
157
|
+
// open a dialog with two custom buttons
|
158
|
+
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"UIActionSheet <title>"
|
159
|
+
delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil
|
160
|
+
otherButtonTitles:@"Button1", @"Button2", nil];
|
161
|
+
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
|
162
|
+
actionSheet.destructiveButtonIndex = 1; // make the second button red (destructive)
|
163
|
+
[actionSheet showInView:self.view]; // show from our table view (pops up in the middle of the table)
|
164
|
+
[actionSheet release];
|
165
|
+
}
|
166
|
+
|
167
|
+
|
168
|
+
#pragma mark -
|
169
|
+
#pragma mark UIAlertView
|
170
|
+
|
171
|
+
- (void)alertSimpleAction
|
172
|
+
{
|
173
|
+
// open an alert with just an OK button
|
174
|
+
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>"
|
175
|
+
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
|
176
|
+
[alert show];
|
177
|
+
[alert release];
|
178
|
+
}
|
179
|
+
|
180
|
+
- (void)alertOKCancelAction
|
181
|
+
{
|
182
|
+
// open a alert with an OK and cancel button
|
183
|
+
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>"
|
184
|
+
delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
|
185
|
+
[alert show];
|
186
|
+
[alert release];
|
187
|
+
}
|
188
|
+
|
189
|
+
- (void)alertOtherAction
|
190
|
+
{
|
191
|
+
// open an alert with two custom buttons
|
192
|
+
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>"
|
193
|
+
delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Button1", @"Button2", nil];
|
194
|
+
[alert show];
|
195
|
+
[alert release];
|
196
|
+
}
|
197
|
+
|
198
|
+
|
199
|
+
#pragma mark -
|
200
|
+
#pragma mark - UIActionSheetDelegate
|
201
|
+
|
202
|
+
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
203
|
+
{
|
204
|
+
// the user clicked one of the OK/Cancel buttons
|
205
|
+
if (buttonIndex == 0)
|
206
|
+
{
|
207
|
+
//NSLog(@"ok");
|
208
|
+
}
|
209
|
+
else
|
210
|
+
{
|
211
|
+
//NSLog(@"cancel");
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
#pragma mark -
|
217
|
+
#pragma mark - UIAlertViewDelegate
|
218
|
+
|
219
|
+
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
220
|
+
{
|
221
|
+
// use "buttonIndex" to decide your action
|
222
|
+
//
|
223
|
+
}
|
224
|
+
|
225
|
+
|
226
|
+
#pragma mark -
|
227
|
+
#pragma mark - UITableView delegates
|
228
|
+
|
229
|
+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
230
|
+
{
|
231
|
+
return [self.dataSourceArray count];
|
232
|
+
}
|
233
|
+
|
234
|
+
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
|
235
|
+
{
|
236
|
+
return [[self.dataSourceArray objectAtIndex: section] valueForKey:kSectionTitleKey];
|
237
|
+
}
|
238
|
+
|
239
|
+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
240
|
+
{
|
241
|
+
return 2;
|
242
|
+
}
|
243
|
+
|
244
|
+
// to determine specific row height for each cell, override this.
|
245
|
+
// In this example, each row is determined by its subviews that are embedded.
|
246
|
+
//
|
247
|
+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
248
|
+
{
|
249
|
+
return ([indexPath row] == 0) ? 50.0 : 22.0;
|
250
|
+
}
|
251
|
+
|
252
|
+
// the table's selection has changed, show the alert or action sheet
|
253
|
+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
254
|
+
{
|
255
|
+
// deselect the current row (don't keep the table selection persistent)
|
256
|
+
[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];
|
257
|
+
|
258
|
+
if (indexPath.row == 0)
|
259
|
+
{
|
260
|
+
switch (indexPath.section)
|
261
|
+
{
|
262
|
+
case kUIAction_Simple_Section:
|
263
|
+
{
|
264
|
+
[self dialogSimpleAction];
|
265
|
+
break;
|
266
|
+
}
|
267
|
+
|
268
|
+
case kUIAction_OKCancel_Section:
|
269
|
+
{
|
270
|
+
[self dialogOKCancelAction];
|
271
|
+
break;
|
272
|
+
}
|
273
|
+
|
274
|
+
case kUIAction_Custom_Section:
|
275
|
+
{
|
276
|
+
[self dialogOtherAction];
|
277
|
+
break;
|
278
|
+
}
|
279
|
+
|
280
|
+
case kUIAlert_Simple_Section:
|
281
|
+
{
|
282
|
+
[self alertSimpleAction];
|
283
|
+
break;
|
284
|
+
}
|
285
|
+
|
286
|
+
case kUIAlert_OKCancel_Section:
|
287
|
+
{
|
288
|
+
[self alertOKCancelAction];
|
289
|
+
break;
|
290
|
+
}
|
291
|
+
|
292
|
+
case kUIAlert_Custom_Section:
|
293
|
+
{
|
294
|
+
[self alertOtherAction];
|
295
|
+
break;
|
296
|
+
}
|
297
|
+
}
|
298
|
+
}
|
299
|
+
}
|
300
|
+
|
301
|
+
// to determine which UITableViewCell to be used on a given row.
|
302
|
+
//
|
303
|
+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
304
|
+
{
|
305
|
+
UITableViewCell *cell = nil;
|
306
|
+
|
307
|
+
if ([indexPath row] == 0)
|
308
|
+
{
|
309
|
+
static NSString *kAlertCell_ID = @"AlertCell_ID";
|
310
|
+
cell = [self.tableView dequeueReusableCellWithIdentifier:kAlertCell_ID];
|
311
|
+
if (cell == nil)
|
312
|
+
{
|
313
|
+
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kAlertCell_ID] autorelease];
|
314
|
+
}
|
315
|
+
|
316
|
+
cell.textLabel.text = [[self.dataSourceArray objectAtIndex: indexPath.section] valueForKey:kLabelKey];
|
317
|
+
}
|
318
|
+
else
|
319
|
+
{
|
320
|
+
static NSString *kSourceCell_ID = @"SourceCell_ID";
|
321
|
+
cell = [self.tableView dequeueReusableCellWithIdentifier:kSourceCell_ID];
|
322
|
+
if (cell == nil)
|
323
|
+
{
|
324
|
+
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kSourceCell_ID] autorelease];
|
325
|
+
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
326
|
+
|
327
|
+
cell.textLabel.opaque = NO;
|
328
|
+
cell.textLabel.textAlignment = UITextAlignmentCenter;
|
329
|
+
cell.textLabel.textColor = [UIColor grayColor];
|
330
|
+
cell.textLabel.numberOfLines = 2;
|
331
|
+
cell.textLabel.font = [UIFont systemFontOfSize:12];
|
332
|
+
}
|
333
|
+
|
334
|
+
cell.textLabel.text = [[self.dataSourceArray objectAtIndex: indexPath.section] valueForKey:kSourceKey];
|
335
|
+
}
|
336
|
+
|
337
|
+
return cell;
|
338
|
+
}
|
339
|
+
|
340
|
+
@end
|
341
|
+
|
data/app/AppDelegate.h
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
/*
|
2
|
+
File: AppDelegate.h
|
3
|
+
Abstract: The application delegate class used for installing our navigation controller.
|
4
|
+
Version: 2.6
|
5
|
+
|
6
|
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
7
|
+
Inc. ("Apple") in consideration of your agreement to the following
|
8
|
+
terms, and your use, installation, modification or redistribution of
|
9
|
+
this Apple software constitutes acceptance of these terms. If you do
|
10
|
+
not agree with these terms, please do not use, install, modify or
|
11
|
+
redistribute this Apple software.
|
12
|
+
|
13
|
+
In consideration of your agreement to abide by the following terms, and
|
14
|
+
subject to these terms, Apple grants you a personal, non-exclusive
|
15
|
+
license, under Apple's copyrights in this original Apple software (the
|
16
|
+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
17
|
+
Software, with or without modifications, in source and/or binary forms;
|
18
|
+
provided that if you redistribute the Apple Software in its entirety and
|
19
|
+
without modifications, you must retain this notice and the following
|
20
|
+
text and disclaimers in all such redistributions of the Apple Software.
|
21
|
+
Neither the name, trademarks, service marks or logos of Apple Inc. may
|
22
|
+
be used to endorse or promote products derived from the Apple Software
|
23
|
+
without specific prior written permission from Apple. Except as
|
24
|
+
expressly stated in this notice, no other rights or licenses, express or
|
25
|
+
implied, are granted by Apple herein, including but not limited to any
|
26
|
+
patent rights that may be infringed by your derivative works or by other
|
27
|
+
works in which the Apple Software may be incorporated.
|
28
|
+
|
29
|
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
30
|
+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
31
|
+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
32
|
+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
33
|
+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
34
|
+
|
35
|
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
36
|
+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
37
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
38
|
+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
39
|
+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
40
|
+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
41
|
+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
42
|
+
POSSIBILITY OF SUCH DAMAGE.
|
43
|
+
|
44
|
+
Copyright (C) 2009 Apple Inc. All Rights Reserved.
|
45
|
+
|
46
|
+
*/
|
47
|
+
|
48
|
+
#import <UIKit/UIKit.h>
|
49
|
+
|
50
|
+
@interface AppDelegate : NSObject <UIApplicationDelegate>
|
51
|
+
{
|
52
|
+
UIWindow *window;
|
53
|
+
UINavigationController *navigationController;
|
54
|
+
}
|
55
|
+
|
56
|
+
@property (nonatomic, retain) IBOutlet UIWindow *window;
|
57
|
+
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
|
58
|
+
|
59
|
+
@end
|
60
|
+
|
data/app/AppDelegate.m
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
/*
|
2
|
+
File: AppDelegate.m
|
3
|
+
Abstract: The application delegate class used for installing our navigation controller.
|
4
|
+
Version: 2.6
|
5
|
+
|
6
|
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
7
|
+
Inc. ("Apple") in consideration of your agreement to the following
|
8
|
+
terms, and your use, installation, modification or redistribution of
|
9
|
+
this Apple software constitutes acceptance of these terms. If you do
|
10
|
+
not agree with these terms, please do not use, install, modify or
|
11
|
+
redistribute this Apple software.
|
12
|
+
|
13
|
+
In consideration of your agreement to abide by the following terms, and
|
14
|
+
subject to these terms, Apple grants you a personal, non-exclusive
|
15
|
+
license, under Apple's copyrights in this original Apple software (the
|
16
|
+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
17
|
+
Software, with or without modifications, in source and/or binary forms;
|
18
|
+
provided that if you redistribute the Apple Software in its entirety and
|
19
|
+
without modifications, you must retain this notice and the following
|
20
|
+
text and disclaimers in all such redistributions of the Apple Software.
|
21
|
+
Neither the name, trademarks, service marks or logos of Apple Inc. may
|
22
|
+
be used to endorse or promote products derived from the Apple Software
|
23
|
+
without specific prior written permission from Apple. Except as
|
24
|
+
expressly stated in this notice, no other rights or licenses, express or
|
25
|
+
implied, are granted by Apple herein, including but not limited to any
|
26
|
+
patent rights that may be infringed by your derivative works or by other
|
27
|
+
works in which the Apple Software may be incorporated.
|
28
|
+
|
29
|
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
30
|
+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
31
|
+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
32
|
+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
33
|
+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
34
|
+
|
35
|
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
36
|
+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
37
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
38
|
+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
39
|
+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
40
|
+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
41
|
+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
42
|
+
POSSIBILITY OF SUCH DAMAGE.
|
43
|
+
|
44
|
+
Copyright (C) 2009 Apple Inc. All Rights Reserved.
|
45
|
+
|
46
|
+
*/
|
47
|
+
|
48
|
+
#import "AppDelegate.h"
|
49
|
+
#import "MainViewController.h"
|
50
|
+
|
51
|
+
// Note about Info.plist:
|
52
|
+
//
|
53
|
+
// If you want the status bar to be hidden at launch use this:
|
54
|
+
// application.statusBarHidden = YES;
|
55
|
+
//
|
56
|
+
// or in your info.plist use:
|
57
|
+
// <key>UIStatusBarHidden</key>
|
58
|
+
// <true/>
|
59
|
+
//
|
60
|
+
// If you want your status bar a particular color at launch use this:
|
61
|
+
// <key>UIStatusBarStyle</key>
|
62
|
+
// <string>UIStatusBarStyleBlackOpaque</string>
|
63
|
+
//
|
64
|
+
// also if you don't want your app icon to be post-rendered with rounded corners and with a shine use
|
65
|
+
// <key>UIPrerenderedIcon</key>
|
66
|
+
// <true/>
|
67
|
+
//
|
68
|
+
|
69
|
+
@implementation AppDelegate
|
70
|
+
|
71
|
+
@synthesize window, navigationController;
|
72
|
+
|
73
|
+
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
|
74
|
+
{
|
75
|
+
// low on memory: do whatever you can to reduce your memory foot print here
|
76
|
+
}
|
77
|
+
|
78
|
+
- (void)applicationDidFinishLaunching:(UIApplication *)application
|
79
|
+
{
|
80
|
+
// To set the status bar as black, use the following:
|
81
|
+
// application.statusBarStyle = UIStatusBarStyleBlackOpaque;
|
82
|
+
|
83
|
+
// this helps in debugging, so that you know "exactly" where your views are placed;
|
84
|
+
// if you see "red", you are looking at the bare window, otherwise use black
|
85
|
+
// window.backgroundColor = [UIColor redColor];
|
86
|
+
|
87
|
+
// add the navigation controller's view to the window
|
88
|
+
[window addSubview: navigationController.view];
|
89
|
+
[window makeKeyAndVisible];
|
90
|
+
}
|
91
|
+
|
92
|
+
- (void)dealloc
|
93
|
+
{
|
94
|
+
[navigationController release];
|
95
|
+
[window release];
|
96
|
+
[super dealloc];
|
97
|
+
}
|
98
|
+
|
99
|
+
@end
|
100
|
+
|
101
|
+
|
@@ -0,0 +1,80 @@
|
|
1
|
+
/*
|
2
|
+
File: ButtonsViewController.h
|
3
|
+
Abstract: The table view controller for hosting the UIButton features of this sample.
|
4
|
+
Version: 2.6
|
5
|
+
|
6
|
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
7
|
+
Inc. ("Apple") in consideration of your agreement to the following
|
8
|
+
terms, and your use, installation, modification or redistribution of
|
9
|
+
this Apple software constitutes acceptance of these terms. If you do
|
10
|
+
not agree with these terms, please do not use, install, modify or
|
11
|
+
redistribute this Apple software.
|
12
|
+
|
13
|
+
In consideration of your agreement to abide by the following terms, and
|
14
|
+
subject to these terms, Apple grants you a personal, non-exclusive
|
15
|
+
license, under Apple's copyrights in this original Apple software (the
|
16
|
+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
17
|
+
Software, with or without modifications, in source and/or binary forms;
|
18
|
+
provided that if you redistribute the Apple Software in its entirety and
|
19
|
+
without modifications, you must retain this notice and the following
|
20
|
+
text and disclaimers in all such redistributions of the Apple Software.
|
21
|
+
Neither the name, trademarks, service marks or logos of Apple Inc. may
|
22
|
+
be used to endorse or promote products derived from the Apple Software
|
23
|
+
without specific prior written permission from Apple. Except as
|
24
|
+
expressly stated in this notice, no other rights or licenses, express or
|
25
|
+
implied, are granted by Apple herein, including but not limited to any
|
26
|
+
patent rights that may be infringed by your derivative works or by other
|
27
|
+
works in which the Apple Software may be incorporated.
|
28
|
+
|
29
|
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
30
|
+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
31
|
+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
32
|
+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
33
|
+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
34
|
+
|
35
|
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
36
|
+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
37
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
38
|
+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
39
|
+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
40
|
+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
41
|
+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
42
|
+
POSSIBILITY OF SUCH DAMAGE.
|
43
|
+
|
44
|
+
Copyright (C) 2009 Apple Inc. All Rights Reserved.
|
45
|
+
|
46
|
+
*/
|
47
|
+
|
48
|
+
#import <UIKit/UIKit.h>
|
49
|
+
|
50
|
+
@interface ButtonsViewController : UITableViewController
|
51
|
+
{
|
52
|
+
UIButton *grayButton;
|
53
|
+
UIButton *imageButton;
|
54
|
+
UIButton *roundedButtonType;
|
55
|
+
|
56
|
+
UIButton *detailDisclosureButtonType;
|
57
|
+
|
58
|
+
UIButton *infoLightButtonType;
|
59
|
+
UIButton *infoDarkButtonType;
|
60
|
+
|
61
|
+
UIButton *contactAddButtonType;
|
62
|
+
|
63
|
+
NSArray *dataSourceArray;
|
64
|
+
}
|
65
|
+
|
66
|
+
@property (nonatomic, retain, readonly) UIButton *grayButton;
|
67
|
+
@property (nonatomic, retain, readonly) UIButton *imageButton;
|
68
|
+
@property (nonatomic, retain, readonly) UIButton *roundedButtonType;
|
69
|
+
|
70
|
+
@property (nonatomic, retain, readonly) UIButton *detailDisclosureButtonType;
|
71
|
+
|
72
|
+
@property (nonatomic, retain, readonly) UIButton *infoLightButtonType;
|
73
|
+
@property (nonatomic, retain, readonly) UIButton *infoDarkButtonType;
|
74
|
+
|
75
|
+
@property (nonatomic, retain, readonly) UIButton *contactAddButtonType;
|
76
|
+
|
77
|
+
@property (nonatomic, retain) NSArray *dataSourceArray;
|
78
|
+
|
79
|
+
@end
|
80
|
+
|