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
@@ -0,0 +1,379 @@
|
|
1
|
+
/*
|
2
|
+
File: ControlsViewController.m
|
3
|
+
Abstract: The view controller for hosting the UIControls 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 "ControlsViewController.h"
|
49
|
+
#import "Constants.h"
|
50
|
+
|
51
|
+
#define kSliderHeight 7.0
|
52
|
+
#define kProgressIndicatorSize 40.0
|
53
|
+
#define kUIProgressBarWidth 160.0
|
54
|
+
#define kUIProgressBarHeight 24.0
|
55
|
+
|
56
|
+
#define kViewTag 1 // for tagging our embedded controls for removal at cell recycle time
|
57
|
+
|
58
|
+
static NSString *kSectionTitleKey = @"sectionTitleKey";
|
59
|
+
static NSString *kLabelKey = @"labelKey";
|
60
|
+
static NSString *kSourceKey = @"sourceKey";
|
61
|
+
static NSString *kViewKey = @"viewKey";
|
62
|
+
|
63
|
+
#pragma mark -
|
64
|
+
|
65
|
+
@implementation ControlsViewController
|
66
|
+
|
67
|
+
@synthesize dataSourceArray;
|
68
|
+
|
69
|
+
- (void)dealloc
|
70
|
+
{
|
71
|
+
[switchCtl release];
|
72
|
+
[sliderCtl release];
|
73
|
+
[customSlider release];
|
74
|
+
[pageControl release];
|
75
|
+
[progressInd release];
|
76
|
+
[progressBar release];
|
77
|
+
|
78
|
+
[dataSourceArray release];
|
79
|
+
|
80
|
+
[super dealloc];
|
81
|
+
}
|
82
|
+
|
83
|
+
- (void)viewDidLoad
|
84
|
+
{
|
85
|
+
[super viewDidLoad];
|
86
|
+
self.title = NSLocalizedString(@"ControlsTitle", @"");
|
87
|
+
|
88
|
+
self.dataSourceArray = [NSArray arrayWithObjects:
|
89
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
90
|
+
@"UISwitch", kSectionTitleKey,
|
91
|
+
@"Standard Switch", kLabelKey,
|
92
|
+
@"ControlsViewController.m:\r-(UISwitch *)switchCtl", kSourceKey,
|
93
|
+
self.switchCtl, kViewKey,
|
94
|
+
nil],
|
95
|
+
|
96
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
97
|
+
@"UISlider", kSectionTitleKey,
|
98
|
+
@"Standard Slider", kLabelKey,
|
99
|
+
@"ControlsViewController.m:\r-(UISlider *)sliderCtl", kSourceKey,
|
100
|
+
self.sliderCtl, kViewKey,
|
101
|
+
nil],
|
102
|
+
|
103
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
104
|
+
@"UISlider", kSectionTitleKey,
|
105
|
+
@"Customized Slider", kLabelKey,
|
106
|
+
@"ControlsViewController.m:\r-(UISlider *)customSlider", kSourceKey,
|
107
|
+
self.customSlider, kViewKey,
|
108
|
+
nil],
|
109
|
+
|
110
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
111
|
+
@"UIPageControl", kSectionTitleKey,
|
112
|
+
@"Ten Pages", kLabelKey,
|
113
|
+
@"ControlsViewController.m:\r-(UIPageControl *)pageControl", kSourceKey,
|
114
|
+
self.pageControl, kViewKey,
|
115
|
+
nil],
|
116
|
+
|
117
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
118
|
+
@"UIActivityIndicatorView", kSectionTitleKey,
|
119
|
+
@"Style Gray", kLabelKey,
|
120
|
+
@"ControlsViewController.m:\r-(UIActivityIndicatorView *)progressInd", kSourceKey,
|
121
|
+
self.progressInd, kViewKey,
|
122
|
+
nil],
|
123
|
+
|
124
|
+
[NSDictionary dictionaryWithObjectsAndKeys:
|
125
|
+
@"UIProgressView", kSectionTitleKey,
|
126
|
+
@"Style Default", kLabelKey,
|
127
|
+
@"ControlsViewController.m:\r-(UIProgressView *)progressBar", kSourceKey,
|
128
|
+
self.progressBar, kViewKey,
|
129
|
+
nil],
|
130
|
+
nil];
|
131
|
+
}
|
132
|
+
|
133
|
+
// called after the view controller's view is released and set to nil.
|
134
|
+
// For example, a memory warning which causes the view to be purged. Not invoked as a result of -dealloc.
|
135
|
+
// So release any properties that are loaded in viewDidLoad or can be recreated lazily.
|
136
|
+
//
|
137
|
+
- (void)viewDidUnload
|
138
|
+
{
|
139
|
+
[super viewDidUnload];
|
140
|
+
|
141
|
+
// release the controls and set them nil in case they were ever created
|
142
|
+
// note: we can't use "self.xxx = nil" since they are read only properties
|
143
|
+
//
|
144
|
+
[switchCtl release];
|
145
|
+
switchCtl = nil;
|
146
|
+
[sliderCtl release];
|
147
|
+
sliderCtl = nil;
|
148
|
+
[customSlider release];
|
149
|
+
customSlider = nil;
|
150
|
+
[pageControl release];
|
151
|
+
pageControl = nil;
|
152
|
+
[progressInd release];
|
153
|
+
progressInd = nil;
|
154
|
+
[progressBar release];
|
155
|
+
progressBar = nil;
|
156
|
+
|
157
|
+
self.dataSourceArray = nil; // this will release and set to nil
|
158
|
+
}
|
159
|
+
|
160
|
+
|
161
|
+
#pragma mark -
|
162
|
+
#pragma mark UITableViewDataSource
|
163
|
+
|
164
|
+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
165
|
+
{
|
166
|
+
return [self.dataSourceArray count];
|
167
|
+
}
|
168
|
+
|
169
|
+
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
|
170
|
+
{
|
171
|
+
return [[self.dataSourceArray objectAtIndex: section] valueForKey:kSectionTitleKey];
|
172
|
+
}
|
173
|
+
|
174
|
+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
175
|
+
{
|
176
|
+
return 2;
|
177
|
+
}
|
178
|
+
|
179
|
+
// to determine specific row height for each cell, override this.
|
180
|
+
// In this example, each row is determined by its subviews that are embedded.
|
181
|
+
//
|
182
|
+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
183
|
+
{
|
184
|
+
return ([indexPath row] == 0) ? 50.0 : 38.0;
|
185
|
+
}
|
186
|
+
|
187
|
+
// to determine which UITableViewCell to be used on a given row.
|
188
|
+
//
|
189
|
+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
190
|
+
{
|
191
|
+
UITableViewCell *cell = nil;
|
192
|
+
|
193
|
+
if ([indexPath row] == 0)
|
194
|
+
{
|
195
|
+
static NSString *kDisplayCell_ID = @"DisplayCellID";
|
196
|
+
cell = [self.tableView dequeueReusableCellWithIdentifier:kDisplayCell_ID];
|
197
|
+
if (cell == nil)
|
198
|
+
{
|
199
|
+
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kDisplayCell_ID] autorelease];
|
200
|
+
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
201
|
+
}
|
202
|
+
else
|
203
|
+
{
|
204
|
+
// the cell is being recycled, remove old embedded controls
|
205
|
+
UIView *viewToRemove = nil;
|
206
|
+
viewToRemove = [cell.contentView viewWithTag:kViewTag];
|
207
|
+
if (viewToRemove)
|
208
|
+
[viewToRemove removeFromSuperview];
|
209
|
+
}
|
210
|
+
|
211
|
+
cell.textLabel.text = [[self.dataSourceArray objectAtIndex: indexPath.section] valueForKey:kLabelKey];
|
212
|
+
|
213
|
+
UIControl *control = [[self.dataSourceArray objectAtIndex: indexPath.section] valueForKey:kViewKey];
|
214
|
+
[cell.contentView addSubview:control];
|
215
|
+
}
|
216
|
+
else
|
217
|
+
{
|
218
|
+
static NSString *kSourceCellID = @"SourceCellID";
|
219
|
+
cell = [self.tableView dequeueReusableCellWithIdentifier:kSourceCellID];
|
220
|
+
if (cell == nil)
|
221
|
+
{
|
222
|
+
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kSourceCellID] autorelease];
|
223
|
+
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
224
|
+
|
225
|
+
cell.textLabel.opaque = NO;
|
226
|
+
cell.textLabel.textAlignment = UITextAlignmentCenter;
|
227
|
+
cell.textLabel.textColor = [UIColor grayColor];
|
228
|
+
cell.textLabel.numberOfLines = 2;
|
229
|
+
cell.textLabel.highlightedTextColor = [UIColor blackColor];
|
230
|
+
cell.textLabel.font = [UIFont systemFontOfSize:12];
|
231
|
+
}
|
232
|
+
|
233
|
+
cell.textLabel.text = [[self.dataSourceArray objectAtIndex: indexPath.section] valueForKey:kSourceKey];
|
234
|
+
}
|
235
|
+
|
236
|
+
return cell;
|
237
|
+
}
|
238
|
+
|
239
|
+
- (void)switchAction:(id)sender
|
240
|
+
{
|
241
|
+
// NSLog(@"switchAction: value = %d", [sender isOn]);
|
242
|
+
}
|
243
|
+
|
244
|
+
- (void)pageAction:(id)sender
|
245
|
+
{
|
246
|
+
// NSLog(@"pageAction: current page = %d", [sender currentPage]);
|
247
|
+
}
|
248
|
+
|
249
|
+
|
250
|
+
#pragma mark -
|
251
|
+
#pragma mark Lazy creation of controls
|
252
|
+
|
253
|
+
- (UISwitch *)switchCtl
|
254
|
+
{
|
255
|
+
if (switchCtl == nil)
|
256
|
+
{
|
257
|
+
CGRect frame = CGRectMake(198.0, 12.0, 94.0, 27.0);
|
258
|
+
switchCtl = [[UISwitch alloc] initWithFrame:frame];
|
259
|
+
[switchCtl addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];
|
260
|
+
|
261
|
+
// in case the parent view draws with a custom color or gradient, use a transparent color
|
262
|
+
switchCtl.backgroundColor = [UIColor clearColor];
|
263
|
+
|
264
|
+
[switchCtl setAccessibilityLabel:NSLocalizedString(@"StandardSwitch", @"")];
|
265
|
+
|
266
|
+
switchCtl.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
|
267
|
+
}
|
268
|
+
return switchCtl;
|
269
|
+
}
|
270
|
+
|
271
|
+
- (UISlider *)sliderCtl
|
272
|
+
{
|
273
|
+
if (sliderCtl == nil)
|
274
|
+
{
|
275
|
+
CGRect frame = CGRectMake(174.0, 12.0, 120.0, kSliderHeight);
|
276
|
+
sliderCtl = [[UISlider alloc] initWithFrame:frame];
|
277
|
+
[sliderCtl addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
|
278
|
+
|
279
|
+
// in case the parent view draws with a custom color or gradient, use a transparent color
|
280
|
+
sliderCtl.backgroundColor = [UIColor clearColor];
|
281
|
+
|
282
|
+
sliderCtl.minimumValue = 0.0;
|
283
|
+
sliderCtl.maximumValue = 100.0;
|
284
|
+
sliderCtl.continuous = YES;
|
285
|
+
sliderCtl.value = 50.0;
|
286
|
+
|
287
|
+
// Add an accessibility label that describes the slider.
|
288
|
+
[sliderCtl setAccessibilityLabel:NSLocalizedString(@"StandardSlider", @"")];
|
289
|
+
|
290
|
+
sliderCtl.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
|
291
|
+
}
|
292
|
+
return sliderCtl;
|
293
|
+
}
|
294
|
+
|
295
|
+
- (UISlider *)customSlider
|
296
|
+
{
|
297
|
+
if (customSlider == nil)
|
298
|
+
{
|
299
|
+
CGRect frame = CGRectMake(174, 12.0, 120.0, kSliderHeight);
|
300
|
+
customSlider = [[UISlider alloc] initWithFrame:frame];
|
301
|
+
[customSlider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
|
302
|
+
// in case the parent view draws with a custom color or gradient, use a transparent color
|
303
|
+
customSlider.backgroundColor = [UIColor clearColor];
|
304
|
+
UIImage *stetchLeftTrack = [[UIImage imageNamed:@"orangeslide.png"]
|
305
|
+
stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
|
306
|
+
UIImage *stetchRightTrack = [[UIImage imageNamed:@"yellowslide.png"]
|
307
|
+
stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
|
308
|
+
[customSlider setThumbImage: [UIImage imageNamed:@"slider_ball.png"] forState:UIControlStateNormal];
|
309
|
+
[customSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
|
310
|
+
[customSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
|
311
|
+
customSlider.minimumValue = 0.0;
|
312
|
+
customSlider.maximumValue = 100.0;
|
313
|
+
customSlider.continuous = YES;
|
314
|
+
customSlider.value = 50.0;
|
315
|
+
|
316
|
+
// Add an accessibility label that describes the slider.
|
317
|
+
[customSlider setAccessibilityLabel:NSLocalizedString(@"CustomSlider", @"")];
|
318
|
+
|
319
|
+
customSlider.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
|
320
|
+
}
|
321
|
+
return customSlider;
|
322
|
+
}
|
323
|
+
|
324
|
+
- (void)sliderAction:(id)sender
|
325
|
+
{ }
|
326
|
+
|
327
|
+
- (UIPageControl *)pageControl
|
328
|
+
{
|
329
|
+
if (pageControl == nil)
|
330
|
+
{
|
331
|
+
CGRect frame = CGRectMake(120.0, 14.0, 178.0, 20.0);
|
332
|
+
pageControl = [[UIPageControl alloc] initWithFrame:frame];
|
333
|
+
[pageControl addTarget:self action:@selector(pageAction:) forControlEvents:UIControlEventTouchUpInside];
|
334
|
+
|
335
|
+
// in case the parent view draws with a custom color or gradient, use a transparent color
|
336
|
+
pageControl.backgroundColor = [UIColor grayColor];
|
337
|
+
|
338
|
+
pageControl.numberOfPages = 10; // must be set or control won't draw
|
339
|
+
|
340
|
+
pageControl.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
|
341
|
+
}
|
342
|
+
return pageControl;
|
343
|
+
}
|
344
|
+
|
345
|
+
- (UIActivityIndicatorView *)progressInd
|
346
|
+
{
|
347
|
+
if (progressInd == nil)
|
348
|
+
{
|
349
|
+
CGRect frame = CGRectMake(265.0, 12.0, kProgressIndicatorSize, kProgressIndicatorSize);
|
350
|
+
progressInd = [[UIActivityIndicatorView alloc] initWithFrame:frame];
|
351
|
+
[progressInd startAnimating];
|
352
|
+
progressInd.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
|
353
|
+
[progressInd sizeToFit];
|
354
|
+
progressInd.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
|
355
|
+
UIViewAutoresizingFlexibleRightMargin |
|
356
|
+
UIViewAutoresizingFlexibleTopMargin |
|
357
|
+
UIViewAutoresizingFlexibleBottomMargin);
|
358
|
+
|
359
|
+
progressInd.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
|
360
|
+
}
|
361
|
+
return progressInd;
|
362
|
+
}
|
363
|
+
|
364
|
+
- (UIProgressView *)progressBar
|
365
|
+
{
|
366
|
+
if (progressBar == nil)
|
367
|
+
{
|
368
|
+
CGRect frame = CGRectMake(126.0, 20.0, kUIProgressBarWidth, kUIProgressBarHeight);
|
369
|
+
progressBar = [[UIProgressView alloc] initWithFrame:frame];
|
370
|
+
progressBar.progressViewStyle = UIProgressViewStyleDefault;
|
371
|
+
progressBar.progress = 0.5;
|
372
|
+
|
373
|
+
progressBar.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
|
374
|
+
}
|
375
|
+
return progressBar;
|
376
|
+
}
|
377
|
+
|
378
|
+
@end
|
379
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
/*
|
2
|
+
File: ImagesViewController.h
|
3
|
+
Abstract: The view controller for hosting the UIImageView containing multiple images.
|
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 ImagesViewController : UIViewController
|
51
|
+
{
|
52
|
+
UIImageView *imageView;
|
53
|
+
UISlider *slider;
|
54
|
+
}
|
55
|
+
|
56
|
+
@property (nonatomic, retain) IBOutlet UIImageView *imageView;
|
57
|
+
@property (nonatomic, retain) IBOutlet UISlider *slider;
|
58
|
+
|
59
|
+
- (IBAction)sliderAction:(id)sender;
|
60
|
+
|
61
|
+
@end
|
62
|
+
|
@@ -0,0 +1,137 @@
|
|
1
|
+
/*
|
2
|
+
File: ImagesViewController.m
|
3
|
+
Abstract: The view controller for hosting the UIImageView containing multiple images.
|
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 "ImagesViewController.h"
|
49
|
+
#import "Constants.h"
|
50
|
+
|
51
|
+
#define kMinDuration 0.0
|
52
|
+
#define kMaxDuration 10.0
|
53
|
+
|
54
|
+
@implementation ImagesViewController
|
55
|
+
|
56
|
+
@synthesize imageView, slider;
|
57
|
+
|
58
|
+
- (void)dealloc
|
59
|
+
{
|
60
|
+
[imageView release];
|
61
|
+
[slider release];
|
62
|
+
|
63
|
+
[super dealloc];
|
64
|
+
}
|
65
|
+
|
66
|
+
- (void)viewDidLoad
|
67
|
+
{
|
68
|
+
[super viewDidLoad];
|
69
|
+
|
70
|
+
self.title = NSLocalizedString(@"ImagesTitle", @"");
|
71
|
+
|
72
|
+
// set up our UIImage with a group or array of images to animate (or in our case a slideshow)
|
73
|
+
self.imageView.animationImages = [NSArray arrayWithObjects:
|
74
|
+
[UIImage imageNamed:@"scene1.jpg"],
|
75
|
+
[UIImage imageNamed:@"scene2.jpg"],
|
76
|
+
[UIImage imageNamed:@"scene3.jpg"],
|
77
|
+
[UIImage imageNamed:@"scene4.jpg"],
|
78
|
+
[UIImage imageNamed:@"scene5.jpg"],
|
79
|
+
nil];
|
80
|
+
imageView.animationDuration = 5.0;
|
81
|
+
[self.imageView stopAnimating];
|
82
|
+
|
83
|
+
// Set the appropriate accessibility labels.
|
84
|
+
[self.imageView setIsAccessibilityElement:YES];
|
85
|
+
[self.imageView setAccessibilityLabel:self.title];
|
86
|
+
[self.slider setAccessibilityLabel:NSLocalizedString(@"DurationSlider",@"")];
|
87
|
+
}
|
88
|
+
|
89
|
+
// called after the view controller's view is released and set to nil.
|
90
|
+
// For example, a memory warning which causes the view to be purged. Not invoked as a result of -dealloc.
|
91
|
+
// So release any properties that are loaded in viewDidLoad or can be recreated lazily.
|
92
|
+
//
|
93
|
+
- (void)viewDidUnload
|
94
|
+
{
|
95
|
+
[super viewDidUnload];
|
96
|
+
|
97
|
+
self.imageView = nil;
|
98
|
+
self.slider = nil;
|
99
|
+
}
|
100
|
+
|
101
|
+
// slown down or speed up the slide show as the slider is moved
|
102
|
+
- (IBAction)sliderAction:(id)sender
|
103
|
+
{
|
104
|
+
UISlider* durationSlider = sender;
|
105
|
+
self.imageView.animationDuration = [durationSlider value];
|
106
|
+
if (!self.imageView.isAnimating)
|
107
|
+
[self.imageView startAnimating];
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
#pragma mark -
|
112
|
+
#pragma mark UIViewController delegate methods
|
113
|
+
|
114
|
+
// called after this controller's view was dismissed, covered or otherwise hidden
|
115
|
+
- (void)viewWillDisappear:(BOOL)animated
|
116
|
+
{
|
117
|
+
[self.imageView stopAnimating];
|
118
|
+
|
119
|
+
// restore the nav bar and status bar color to default
|
120
|
+
self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
|
121
|
+
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
|
122
|
+
}
|
123
|
+
|
124
|
+
// called after this controller's view will appear
|
125
|
+
- (void)viewWillAppear:(BOOL)animated
|
126
|
+
{
|
127
|
+
[self.imageView startAnimating];
|
128
|
+
|
129
|
+
// for aesthetic reasons (the background is black), make the nav bar black for this particular page
|
130
|
+
self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
|
131
|
+
|
132
|
+
// match the status bar with the nav bar
|
133
|
+
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;
|
134
|
+
}
|
135
|
+
|
136
|
+
@end
|
137
|
+
|
@@ -3,15 +3,15 @@
|
|
3
3
|
<plist version="1.0">
|
4
4
|
<dict>
|
5
5
|
<key>CFBundleDevelopmentRegion</key>
|
6
|
-
<string>
|
6
|
+
<string>en</string>
|
7
7
|
<key>CFBundleDisplayName</key>
|
8
8
|
<string>${PRODUCT_NAME}</string>
|
9
9
|
<key>CFBundleExecutable</key>
|
10
10
|
<string>${EXECUTABLE_NAME}</string>
|
11
11
|
<key>CFBundleIconFile</key>
|
12
|
-
<string
|
12
|
+
<string>Icon.png</string>
|
13
13
|
<key>CFBundleIdentifier</key>
|
14
|
-
<string>com.yourcompany.${PRODUCT_NAME:
|
14
|
+
<string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
|
15
15
|
<key>CFBundleInfoDictionaryVersion</key>
|
16
16
|
<string>6.0</string>
|
17
17
|
<key>CFBundleName</key>
|
@@ -21,7 +21,7 @@
|
|
21
21
|
<key>CFBundleSignature</key>
|
22
22
|
<string>????</string>
|
23
23
|
<key>CFBundleVersion</key>
|
24
|
-
<string>
|
24
|
+
<string>2.6</string>
|
25
25
|
<key>LSRequiresIPhoneOS</key>
|
26
26
|
<true/>
|
27
27
|
<key>NSMainNibFile</key>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/*
|
2
|
+
File: MainViewController.h
|
3
|
+
Abstract: The application's main view controller (front page).
|
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 MainViewController : UITableViewController
|
51
|
+
{
|
52
|
+
NSMutableArray *menuList;
|
53
|
+
}
|
54
|
+
|
55
|
+
@property (nonatomic, retain) NSMutableArray *menuList;
|
56
|
+
|
57
|
+
@end
|