iCuke 0.4.12 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. data/Rakefile +3 -3
  2. data/VERSION +1 -1
  3. data/app/AlertsViewController.h +59 -0
  4. data/app/AlertsViewController.m +341 -0
  5. data/app/AppDelegate.h +60 -0
  6. data/app/AppDelegate.m +101 -0
  7. data/app/ButtonsViewController.h +80 -0
  8. data/app/ButtonsViewController.m +448 -0
  9. data/app/Constants.h +58 -0
  10. data/app/ControlsViewController.h +72 -0
  11. data/app/ControlsViewController.m +379 -0
  12. data/app/ImagesViewController.h +62 -0
  13. data/app/ImagesViewController.m +137 -0
  14. data/app/{iCuke/iCuke-Info.plist → Info.plist} +4 -4
  15. data/app/MainViewController.h +57 -0
  16. data/app/MainViewController.m +262 -0
  17. data/app/Picker/CustomPickerDataSource.h +55 -0
  18. data/app/Picker/CustomPickerDataSource.m +135 -0
  19. data/app/Picker/CustomView.h +62 -0
  20. data/app/Picker/CustomView.m +119 -0
  21. data/app/PickerViewController.h +88 -0
  22. data/app/PickerViewController.m +402 -0
  23. data/app/Prefix.pch +5 -0
  24. data/app/ReadMe.txt +82 -0
  25. data/app/SearchBarController.h +58 -0
  26. data/app/SearchBarController.m +105 -0
  27. data/app/SegmentViewController.h +54 -0
  28. data/app/SegmentViewController.m +195 -0
  29. data/app/TextFieldController.h +67 -0
  30. data/app/TextFieldController.m +342 -0
  31. data/app/TextViewController.h +57 -0
  32. data/app/TextViewController.m +164 -0
  33. data/app/ToolbarViewController.h +74 -0
  34. data/app/ToolbarViewController.m +303 -0
  35. data/app/TransitionViewController.h +64 -0
  36. data/app/TransitionViewController.m +178 -0
  37. data/app/UICatalog.xcodeproj/project.pbxproj +615 -0
  38. data/app/WebViewController.h +57 -0
  39. data/app/WebViewController.m +173 -0
  40. data/app/en.lproj/AlertsViewController.xib +144 -0
  41. data/app/en.lproj/ButtonsViewController.xib +147 -0
  42. data/app/en.lproj/ControlsViewController.xib +147 -0
  43. data/app/en.lproj/ImagesViewController.xib +264 -0
  44. data/app/en.lproj/Localizable.strings +41 -0
  45. data/app/en.lproj/MainWindow.xib +306 -0
  46. data/app/en.lproj/PickerViewController.xib +415 -0
  47. data/app/en.lproj/SearchBarController.xib +142 -0
  48. data/app/en.lproj/SegmentViewController.xib +143 -0
  49. data/app/en.lproj/TextFieldController.xib +167 -0
  50. data/app/en.lproj/TextViewController.xib +149 -0
  51. data/app/en.lproj/ToolbarViewController.xib +491 -0
  52. data/app/en.lproj/TransitionViewController.xib +255 -0
  53. data/app/en.lproj/WebViewController.xib +141 -0
  54. data/app/images/12-6AM.png +0 -0
  55. data/app/images/12-6PM.png +0 -0
  56. data/app/images/6-12AM.png +0 -0
  57. data/app/images/6-12PM.png +0 -0
  58. data/app/images/Default.png +0 -0
  59. data/app/images/Icon.png +0 -0
  60. data/app/images/UIButton_custom.png +0 -0
  61. data/app/images/blueButton.png +0 -0
  62. data/app/images/orangeslide.png +0 -0
  63. data/app/images/scene1.jpg +0 -0
  64. data/app/images/scene2.jpg +0 -0
  65. data/app/images/scene3.jpg +0 -0
  66. data/app/images/scene4.jpg +0 -0
  67. data/app/images/scene5.jpg +0 -0
  68. data/app/images/segment_check.png +0 -0
  69. data/app/images/segment_search.png +0 -0
  70. data/app/images/segment_tools.png +0 -0
  71. data/app/images/slider_ball.png +0 -0
  72. data/app/images/whiteButton.png +0 -0
  73. data/app/images/yellowslide.png +0 -0
  74. data/app/main.m +58 -0
  75. data/ext/iCuke/DefaultsResponse.m +0 -1
  76. data/ext/iCuke/EventResponse.m +9 -1
  77. data/ext/iCuke/Rakefile +1 -1
  78. data/ext/iCuke/Recorder.h +3 -1
  79. data/ext/iCuke/Recorder.m +10 -5
  80. data/ext/iCuke/RecorderResponse.h +1 -0
  81. data/ext/iCuke/RecorderResponse.m +10 -1
  82. data/ext/iCuke/Viewer.m +5 -6
  83. data/ext/iCuke/iCukeHTTPServer.m +1 -1
  84. data/ext/iCuke/iCukeServer.m +24 -7
  85. data/ext/iCuke/libicuke.dylib +0 -0
  86. data/features/uicatalog.feature +20 -0
  87. data/iCuke.gemspec +81 -24
  88. data/lib/icuke/com.apple.Accessibility.plist +0 -0
  89. data/lib/icuke/core_ext.rb +26 -0
  90. data/lib/icuke/cucumber.rb +20 -12
  91. data/lib/icuke/headless.rb +55 -0
  92. data/lib/icuke/simulator.rb +7 -129
  93. data/lib/icuke/xcode.rb +136 -0
  94. metadata +82 -25
  95. data/app/iCuke/Classes/FlipsideView.h +0 -13
  96. data/app/iCuke/Classes/FlipsideView.m +0 -32
  97. data/app/iCuke/Classes/FlipsideViewController.h +0 -25
  98. data/app/iCuke/Classes/FlipsideViewController.m +0 -54
  99. data/app/iCuke/Classes/MainView.h +0 -15
  100. data/app/iCuke/Classes/MainView.m +0 -32
  101. data/app/iCuke/Classes/MainViewController.h +0 -16
  102. data/app/iCuke/Classes/MainViewController.m +0 -86
  103. data/app/iCuke/Classes/iCukeAppDelegate.h +0 -20
  104. data/app/iCuke/Classes/iCukeAppDelegate.m +0 -33
  105. data/app/iCuke/FlipsideView.xib +0 -444
  106. data/app/iCuke/MainView.xib +0 -520
  107. data/app/iCuke/MainWindow.xib +0 -355
  108. data/app/iCuke/SniffingView.h +0 -20
  109. data/app/iCuke/SniffingView.m +0 -191
  110. data/app/iCuke/iCuke.xcodeproj/project.pbxproj +0 -313
  111. data/app/iCuke/iCuke_Prefix.pch +0 -14
  112. data/app/iCuke/main.m +0 -16
  113. data/features/icuke.feature +0 -17
  114. /data/app/{iCuke/.gitignore → .gitignore} +0 -0
@@ -0,0 +1,448 @@
1
+ /*
2
+ File: ButtonsViewController.m
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 "ButtonsViewController.h"
49
+ #import "Constants.h"
50
+
51
+ #define kStdButtonWidth 106.0
52
+ #define kStdButtonHeight 40.0
53
+
54
+ #define kViewTag 1 // for tagging our embedded controls for removal at cell recycle time
55
+
56
+ static NSString *kSectionTitleKey = @"sectionTitleKey";
57
+ static NSString *kLabelKey = @"labelKey";
58
+ static NSString *kSourceKey = @"sourceKey";
59
+ static NSString *kViewKey = @"viewKey";
60
+
61
+ #pragma mark -
62
+
63
+ @implementation ButtonsViewController
64
+
65
+ @synthesize dataSourceArray;
66
+
67
+ - (void)dealloc
68
+ {
69
+ [grayButton release];
70
+ [imageButton release];
71
+ [roundedButtonType release];
72
+
73
+ [detailDisclosureButtonType release];
74
+ [infoLightButtonType release];
75
+ [infoDarkButtonType release];
76
+ [contactAddButtonType release];
77
+
78
+ [dataSourceArray release];
79
+
80
+ [super dealloc];
81
+ }
82
+
83
+ - (void)viewDidLoad
84
+ {
85
+ [super viewDidLoad];
86
+
87
+ self.title = NSLocalizedString(@"ButtonsTitle", @"");
88
+
89
+ self.dataSourceArray = [NSArray arrayWithObjects:
90
+ [NSDictionary dictionaryWithObjectsAndKeys:
91
+ @"UIButton", kSectionTitleKey,
92
+ @"Background Image", kLabelKey,
93
+ @"ButtonsViewController.m:\r(UIButton *)grayButton", kSourceKey,
94
+ self.grayButton, kViewKey,
95
+ nil],
96
+
97
+ [NSDictionary dictionaryWithObjectsAndKeys:
98
+ @"UIButton", kSectionTitleKey,
99
+ @"Button with Image", kLabelKey,
100
+ @"ButtonsViewController.m:\r(UIButton *)imageButton", kSourceKey,
101
+ self.imageButton, kViewKey,
102
+ nil],
103
+
104
+ [NSDictionary dictionaryWithObjectsAndKeys:
105
+ @"UIButtonTypeRoundedRect", kSectionTitleKey,
106
+ @"Rounded Button", kLabelKey,
107
+ @"ButtonsViewController.m:\r(UIButton *)roundedButtonType", kSourceKey,
108
+ self.roundedButtonType, kViewKey,
109
+ nil],
110
+
111
+ [NSDictionary dictionaryWithObjectsAndKeys:
112
+ @"UIButtonTypeDetailDisclosure", kSectionTitleKey,
113
+ @"Detail Disclosure", kLabelKey,
114
+ @"ButtonsViewController.m:\r(UIButton *)detailDisclosureButton", kSourceKey,
115
+ self.detailDisclosureButtonType, kViewKey,
116
+ nil],
117
+
118
+ [NSDictionary dictionaryWithObjectsAndKeys:
119
+ @"UIButtonTypeInfoLight", kSectionTitleKey,
120
+ @"Info Light", kLabelKey,
121
+ @"ButtonsViewController.m:\r(UIButton *)infoLightButtonType", kSourceKey,
122
+ self.infoLightButtonType, kViewKey,
123
+ nil],
124
+
125
+ [NSDictionary dictionaryWithObjectsAndKeys:
126
+ @"UIButtonTypeInfoDark", kSectionTitleKey,
127
+ @"Info Dark", kLabelKey,
128
+ @"ButtonsViewController.m:\r(UIButton *)infoDarkButtonType", kSourceKey,
129
+ self.infoDarkButtonType, kViewKey,
130
+ nil],
131
+
132
+ [NSDictionary dictionaryWithObjectsAndKeys:
133
+ @"UIButtonTypeContactAdd", kSectionTitleKey,
134
+ @"Contact Add", kLabelKey,
135
+ @"ButtonsViewController.m:\r(UIButton *)contactAddButtonType", kSourceKey,
136
+ self.contactAddButtonType, kViewKey,
137
+ nil],
138
+ nil];
139
+ }
140
+
141
+ // called after the view controller's view is released and set to nil.
142
+ // For example, a memory warning which causes the view to be purged. Not invoked as a result of -dealloc.
143
+ // So release any properties that are loaded in viewDidLoad or can be recreated lazily.
144
+ //
145
+ - (void)viewDidUnload
146
+ {
147
+ [super viewDidUnload];
148
+
149
+ // release the controls and set them nil in case they were ever created
150
+ // note: we can't use "self.xxx = nil" since they are read only properties
151
+ //
152
+ [grayButton release];
153
+ grayButton = nil;
154
+ [imageButton release];
155
+ imageButton = nil;
156
+ [roundedButtonType release];
157
+ roundedButtonType = nil;
158
+ [detailDisclosureButtonType release];
159
+ detailDisclosureButtonType = nil;
160
+ [infoLightButtonType release];
161
+ infoLightButtonType = nil;
162
+ [infoDarkButtonType release];
163
+ infoDarkButtonType = nil;
164
+ [contactAddButtonType release];
165
+ contactAddButtonType = nil;
166
+
167
+ self.dataSourceArray = nil;
168
+ }
169
+
170
+
171
+ #pragma mark -
172
+ #pragma mark UITableViewDataSource
173
+
174
+ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
175
+ {
176
+ return [self.dataSourceArray count];
177
+ }
178
+
179
+ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
180
+ {
181
+ return [[self.dataSourceArray objectAtIndex: section] valueForKey:kSectionTitleKey];
182
+ }
183
+
184
+ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
185
+ {
186
+ return 2;
187
+ }
188
+
189
+ // to determine specific row height for each cell, override this.
190
+ // In this example, each row is determined by its subviews that are embedded.
191
+ //
192
+ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
193
+ {
194
+ return ([indexPath row] == 0) ? 50.0 : 38.0;
195
+ }
196
+
197
+ // to determine which UITableViewCell to be used on a given row.
198
+ //
199
+ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
200
+ {
201
+ UITableViewCell *cell = nil;
202
+
203
+ if ([indexPath row] == 0)
204
+ {
205
+ static NSString *kDisplayCell_ID = @"DisplayCellID";
206
+ cell = [self.tableView dequeueReusableCellWithIdentifier:kDisplayCell_ID];
207
+ if (cell == nil)
208
+ {
209
+ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kDisplayCell_ID] autorelease];
210
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
211
+ }
212
+ else
213
+ {
214
+ // the cell is being recycled, remove old embedded controls
215
+ UIView *viewToRemove = nil;
216
+ viewToRemove = [cell.contentView viewWithTag:kViewTag];
217
+ if (viewToRemove)
218
+ [viewToRemove removeFromSuperview];
219
+ }
220
+
221
+ cell.textLabel.text = [[self.dataSourceArray objectAtIndex: indexPath.section] valueForKey:kLabelKey];
222
+
223
+ UIButton *button = [[self.dataSourceArray objectAtIndex: indexPath.section] valueForKey:kViewKey];
224
+ [cell.contentView addSubview:button];
225
+ }
226
+ else
227
+ {
228
+ static NSString *kSourceCellID = @"SourceCellID";
229
+ cell = [self.tableView dequeueReusableCellWithIdentifier:kSourceCellID];
230
+ if (cell == nil)
231
+ {
232
+ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kSourceCellID] autorelease];
233
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
234
+
235
+ cell.textLabel.opaque = NO;
236
+ cell.textLabel.textAlignment = UITextAlignmentCenter;
237
+ cell.textLabel.textColor = [UIColor grayColor];
238
+ cell.textLabel.numberOfLines = 2;
239
+ cell.textLabel.highlightedTextColor = [UIColor blackColor];
240
+ cell.textLabel.font = [UIFont systemFontOfSize:12];
241
+ }
242
+
243
+ cell.textLabel.text = [[self.dataSourceArray objectAtIndex: indexPath.section] valueForKey:kSourceKey];
244
+ }
245
+
246
+ return cell;
247
+ }
248
+
249
+
250
+ #pragma mark -
251
+
252
+ + (UIButton *)buttonWithTitle: (NSString *)title
253
+ target:(id)target
254
+ selector:(SEL)selector
255
+ frame:(CGRect)frame
256
+ image:(UIImage *)image
257
+ imagePressed:(UIImage *)imagePressed
258
+ darkTextColor:(BOOL)darkTextColor
259
+ {
260
+ UIButton *button = [[UIButton alloc] initWithFrame:frame];
261
+ // or you can do this:
262
+ // UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
263
+ // button.frame = frame;
264
+
265
+ button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
266
+ button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
267
+
268
+ [button setTitle:title forState:UIControlStateNormal];
269
+ if (darkTextColor)
270
+ {
271
+ [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
272
+ }
273
+ else
274
+ {
275
+ [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
276
+ }
277
+
278
+ UIImage *newImage = [image stretchableImageWithLeftCapWidth:12.0 topCapHeight:0.0];
279
+ [button setBackgroundImage:newImage forState:UIControlStateNormal];
280
+
281
+ UIImage *newPressedImage = [imagePressed stretchableImageWithLeftCapWidth:12.0 topCapHeight:0.0];
282
+ [button setBackgroundImage:newPressedImage forState:UIControlStateHighlighted];
283
+
284
+ [button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
285
+
286
+ // in case the parent view draws with a custom color or gradient, use a transparent color
287
+ button.backgroundColor = [UIColor clearColor];
288
+
289
+ return button;
290
+ }
291
+
292
+ - (void)action:(id)sender
293
+ {
294
+ //NSLog(@"UIButton was clicked");
295
+ }
296
+
297
+ #pragma mark -
298
+ #pragma mark Lazy creation of buttons
299
+
300
+ - (UIButton *)grayButton
301
+ {
302
+ if (grayButton == nil)
303
+ {
304
+ // create the UIButtons with various background images
305
+ // white button:
306
+ UIImage *buttonBackground = [UIImage imageNamed:@"whiteButton.png"];
307
+ UIImage *buttonBackgroundPressed = [UIImage imageNamed:@"blueButton.png"];
308
+
309
+ CGRect frame = CGRectMake(182.0, 5.0, kStdButtonWidth, kStdButtonHeight);
310
+
311
+ grayButton = [ButtonsViewController buttonWithTitle:@"Gray"
312
+ target:self
313
+ selector:@selector(action:)
314
+ frame:frame
315
+ image:buttonBackground
316
+ imagePressed:buttonBackgroundPressed
317
+ darkTextColor:YES];
318
+
319
+ grayButton.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
320
+ }
321
+ return grayButton;
322
+ }
323
+
324
+ - (UIButton *)imageButton
325
+ {
326
+ if (imageButton == nil)
327
+ {
328
+ // create a UIButton with just an image instead of a title
329
+
330
+ UIImage *buttonBackground = [UIImage imageNamed:@"whiteButton.png"];
331
+ UIImage *buttonBackgroundPressed = [UIImage imageNamed:@"blueButton.png"];
332
+
333
+ CGRect frame = CGRectMake(182.0, 5.0, kStdButtonWidth, kStdButtonHeight);
334
+
335
+ imageButton = [ButtonsViewController buttonWithTitle:@""
336
+ target:self
337
+ selector:@selector(action:)
338
+ frame:frame
339
+ image:buttonBackground
340
+ imagePressed:buttonBackgroundPressed
341
+ darkTextColor:YES];
342
+
343
+ [imageButton setImage:[UIImage imageNamed:@"UIButton_custom.png"] forState:UIControlStateNormal];
344
+
345
+ // Add an accessibility label to the image.
346
+ [imageButton setAccessibilityLabel:NSLocalizedString(@"ArrowButton", @"")];
347
+
348
+ imageButton.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
349
+ }
350
+ return imageButton;
351
+ }
352
+
353
+ - (UIButton *)roundedButtonType
354
+ {
355
+ if (roundedButtonType == nil)
356
+ {
357
+ // create a UIButton (UIButtonTypeRoundedRect)
358
+ roundedButtonType = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
359
+ roundedButtonType.frame = CGRectMake(182.0, 5.0, kStdButtonWidth, kStdButtonHeight);
360
+ [roundedButtonType setTitle:@"Rounded" forState:UIControlStateNormal];
361
+ roundedButtonType.backgroundColor = [UIColor clearColor];
362
+ [roundedButtonType addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
363
+
364
+ roundedButtonType.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
365
+ }
366
+ return roundedButtonType;
367
+ }
368
+
369
+ - (UIButton *)detailDisclosureButtonType
370
+ {
371
+ if (detailDisclosureButtonType == nil)
372
+ {
373
+ // create a UIButton (UIButtonTypeDetailDisclosure)
374
+ detailDisclosureButtonType = [[UIButton buttonWithType:UIButtonTypeDetailDisclosure] retain];
375
+ detailDisclosureButtonType.frame = CGRectMake(250.0, 8.0, 25.0, 25.0);
376
+ [detailDisclosureButtonType setTitle:@"Detail Disclosure" forState:UIControlStateNormal];
377
+ detailDisclosureButtonType.backgroundColor = [UIColor clearColor];
378
+ [detailDisclosureButtonType addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
379
+
380
+ // Add a custom accessibility label to the button because it has no associated text.
381
+ [detailDisclosureButtonType setAccessibilityLabel:NSLocalizedString(@"MoreInfoButton", @"")];
382
+
383
+ detailDisclosureButtonType.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
384
+ }
385
+ return detailDisclosureButtonType;
386
+ }
387
+
388
+ - (UIButton *)infoDarkButtonType
389
+ {
390
+ if (infoDarkButtonType == nil)
391
+ {
392
+ // create a UIButton (UIButtonTypeInfoLight)
393
+ infoDarkButtonType = [[UIButton buttonWithType:UIButtonTypeInfoDark] retain];
394
+ infoDarkButtonType.frame = CGRectMake(250.0, 8.0, 25.0, 25.0);
395
+ [infoDarkButtonType setTitle:@"Detail Disclosure" forState:UIControlStateNormal];
396
+ infoDarkButtonType.backgroundColor = [UIColor clearColor];
397
+ [infoDarkButtonType addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
398
+
399
+ // Add a custom accessibility label to the button because it has no associated text.
400
+ [infoDarkButtonType setAccessibilityLabel:NSLocalizedString(@"MoreInfoButton", @"")];
401
+
402
+ infoDarkButtonType.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
403
+ }
404
+ return infoDarkButtonType;
405
+ }
406
+
407
+ - (UIButton *)infoLightButtonType
408
+ {
409
+ if (infoLightButtonType == nil)
410
+ {
411
+ // create a UIButton (UIButtonTypeInfoLight)
412
+ infoLightButtonType = [[UIButton buttonWithType:UIButtonTypeInfoLight] retain];
413
+ infoLightButtonType.frame = CGRectMake(250.0, 8.0, 25.0, 25.0);
414
+ [infoLightButtonType setTitle:@"Detail Disclosure" forState:UIControlStateNormal];
415
+ infoLightButtonType.backgroundColor = [UIColor clearColor];
416
+ [infoLightButtonType addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
417
+ infoLightButtonType.backgroundColor = [UIColor grayColor];
418
+
419
+ // Add a custom accessibility label to the button because it has no associated text.
420
+ [infoLightButtonType setAccessibilityLabel:NSLocalizedString(@"MoreInfoButton", @"")];
421
+
422
+ infoLightButtonType.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
423
+ }
424
+
425
+ return infoLightButtonType;
426
+ }
427
+
428
+ - (UIButton *)contactAddButtonType
429
+ {
430
+ if (contactAddButtonType == nil)
431
+ {
432
+ // create a UIButton (UIButtonTypeContactAdd)
433
+ contactAddButtonType = [[UIButton buttonWithType:UIButtonTypeContactAdd] retain];
434
+ contactAddButtonType.frame = CGRectMake(250.0, 8.0, 25.0, 25.0);
435
+ [contactAddButtonType setTitle:@"Detail Disclosure" forState:UIControlStateNormal];
436
+ contactAddButtonType.backgroundColor = [UIColor clearColor];
437
+ [contactAddButtonType addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
438
+
439
+ // Add a custom accessibility label to the button because it has no associated text.
440
+ [contactAddButtonType setAccessibilityLabel:NSLocalizedString(@"AddContactButton", @"")];
441
+
442
+ contactAddButtonType.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells
443
+ }
444
+ return contactAddButtonType;
445
+ }
446
+
447
+ @end
448
+
data/app/Constants.h ADDED
@@ -0,0 +1,58 @@
1
+ /*
2
+ File: Constants.h
3
+ Abstract: Common constants across source files (screen coordinate consts, etc.)
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
+ // these are the various screen placement constants used across most the UIViewControllers
49
+
50
+ // padding for margins
51
+
52
+ // for general screen
53
+ #define kLeftMargin 20.0
54
+ #define kTopMargin 20.0
55
+ #define kRightMargin 20.0
56
+ #define kTweenMargin 10.0
57
+
58
+ #define kTextFieldHeight 30.0
@@ -0,0 +1,72 @@
1
+ /*
2
+ File: ControlsViewController.h
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 <UIKit/UIKit.h>
49
+
50
+ @interface ControlsViewController : UITableViewController
51
+ {
52
+ UISwitch *switchCtl;
53
+ UISlider *sliderCtl;
54
+ UISlider *customSlider;
55
+ UIPageControl *pageControl;
56
+ UIActivityIndicatorView *progressInd;
57
+ UIProgressView *progressBar;
58
+
59
+ NSArray *dataSourceArray;
60
+ }
61
+
62
+ @property (nonatomic, retain, readonly) UISwitch *switchCtl;
63
+ @property (nonatomic, retain, readonly) UISlider *sliderCtl;
64
+ @property (nonatomic, retain, readonly) UISlider *customSlider;
65
+ @property (nonatomic, retain, readonly) UIPageControl *pageControl;
66
+ @property (nonatomic, retain, readonly) UIActivityIndicatorView *progressInd;
67
+ @property (nonatomic, retain, readonly) UIProgressView *progressBar;
68
+
69
+ @property (nonatomic, retain) NSArray *dataSourceArray;
70
+
71
+ @end
72
+