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,88 @@
1
+ /*
2
+ File: PickerViewController.h
3
+ Abstract: The view controller for hosting the UIPickerView 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
+ #import "CustomPickerDataSource.h"
50
+
51
+ @interface PickerViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource>
52
+ {
53
+ UIPickerView *myPickerView;
54
+ UIDatePicker *datePickerView;
55
+ NSArray *pickerViewArray;
56
+
57
+ UILabel *label;
58
+
59
+ UIPickerView *customPickerView;
60
+ CustomPickerDataSource *customPickerDataSource;
61
+
62
+ UIView *currentPicker;
63
+
64
+ UISegmentedControl *buttonBarSegmentedControl;
65
+ UISegmentedControl *pickerStyleSegmentedControl;
66
+ UILabel *segmentLabel;
67
+ }
68
+
69
+ @property (nonatomic, retain) UIPickerView *myPickerView;
70
+ @property (nonatomic, retain) UIDatePicker *datePickerView;
71
+ @property (nonatomic, retain) NSArray *pickerViewArray;
72
+
73
+ @property (nonatomic, retain) UILabel *label;
74
+
75
+ @property (nonatomic, retain) UIPickerView *customPickerView;
76
+ @property (nonatomic, retain) CustomPickerDataSource *customPickerDataSource;
77
+
78
+ @property (nonatomic, retain) UIView *currentPicker;
79
+
80
+ @property (nonatomic, retain) IBOutlet UISegmentedControl *buttonBarSegmentedControl;
81
+ @property (nonatomic, retain) IBOutlet UISegmentedControl *pickerStyleSegmentedControl;
82
+ @property (nonatomic, retain) IBOutlet UILabel *segmentLabel;
83
+
84
+
85
+ - (IBAction)togglePickers:(id)sender; // for changing between UIPickerView, UIDatePickerView and custom picker
86
+ - (IBAction)togglePickerStyle:(id)sender; // for changing the date picker's style
87
+
88
+ @end
@@ -0,0 +1,402 @@
1
+ /*
2
+ File: PickerViewController.m
3
+ Abstract: The view controller for hosting the UIPickerView 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 "PickerViewController.h"
49
+ #import "CustomView.h"
50
+ #import "Constants.h"
51
+
52
+ @implementation PickerViewController
53
+
54
+ @synthesize buttonBarSegmentedControl, pickerStyleSegmentedControl, segmentLabel, currentPicker;
55
+ @synthesize myPickerView, datePickerView, pickerViewArray, label, customPickerView, customPickerDataSource;
56
+
57
+ // return the picker frame based on its size, positioned at the bottom of the page
58
+ - (CGRect)pickerFrameWithSize:(CGSize)size
59
+ {
60
+ CGRect screenRect = [[UIScreen mainScreen] applicationFrame];
61
+ CGRect pickerRect = CGRectMake( 0.0,
62
+ screenRect.size.height - 84.0 - size.height,
63
+ size.width,
64
+ size.height);
65
+ return pickerRect;
66
+ }
67
+
68
+ #pragma mark -
69
+ #pragma mark UIPickerView
70
+ - (void)createPicker
71
+ {
72
+ pickerViewArray = [[NSArray arrayWithObjects:
73
+ @"John Appleseed", @"Chris Armstrong", @"Serena Auroux",
74
+ @"Susan Bean", @"Luis Becerra", @"Kate Bell", @"Alain Briere",
75
+ nil] retain];
76
+ // note we are using CGRectZero for the dimensions of our picker view,
77
+ // this is because picker views have a built in optimum size,
78
+ // you just need to set the correct origin in your view.
79
+ //
80
+ // position the picker at the bottom
81
+ myPickerView = [[UIPickerView alloc] initWithFrame:CGRectZero];
82
+ CGSize pickerSize = [myPickerView sizeThatFits:CGSizeZero];
83
+ myPickerView.frame = [self pickerFrameWithSize:pickerSize];
84
+
85
+ myPickerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
86
+ myPickerView.showsSelectionIndicator = YES; // note this is default to NO
87
+
88
+ // this view controller is the data source and delegate
89
+ myPickerView.delegate = self;
90
+ myPickerView.dataSource = self;
91
+
92
+ // add this picker to our view controller, initially hidden
93
+ myPickerView.hidden = YES;
94
+ [self.view addSubview:myPickerView];
95
+ }
96
+
97
+ #pragma mark
98
+ #pragma mark UIPickerView - Date/Time
99
+ - (void)createDatePicker
100
+ {
101
+ datePickerView = [[UIDatePicker alloc] initWithFrame:CGRectZero];
102
+ datePickerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
103
+ datePickerView.datePickerMode = UIDatePickerModeDate;
104
+
105
+ // note we are using CGRectZero for the dimensions of our picker view,
106
+ // this is because picker views have a built in optimum size,
107
+ // you just need to set the correct origin in your view.
108
+ //
109
+ // position the picker at the bottom
110
+ CGSize pickerSize = [myPickerView sizeThatFits:CGSizeZero];
111
+ datePickerView.frame = [self pickerFrameWithSize:pickerSize];
112
+
113
+ // add this picker to our view controller, initially hidden
114
+ datePickerView.hidden = YES;
115
+ [self.view addSubview:datePickerView];
116
+ }
117
+
118
+ #pragma mark
119
+ #pragma mark UIPickerView - Custom Picker
120
+ - (void)createCustomPicker
121
+ {
122
+ customPickerView = [[UIPickerView alloc] initWithFrame:CGRectZero];
123
+ customPickerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
124
+
125
+ // setup the data source and delegate for this picker
126
+ customPickerDataSource = [[CustomPickerDataSource alloc] init];
127
+ customPickerView.dataSource = customPickerDataSource;
128
+ customPickerView.delegate = customPickerDataSource;
129
+
130
+ // note we are using CGRectZero for the dimensions of our picker view,
131
+ // this is because picker views have a built in optimum size,
132
+ // you just need to set the correct origin in your view.
133
+ //
134
+ // position the picker at the bottom
135
+ CGSize pickerSize = [myPickerView sizeThatFits:CGSizeZero];
136
+ customPickerView.frame = [self pickerFrameWithSize:pickerSize];
137
+
138
+ customPickerView.showsSelectionIndicator = YES;
139
+
140
+ // add this picker to our view controller, initially hidden
141
+ customPickerView.hidden = YES;
142
+ [self.view addSubview:customPickerView];
143
+ }
144
+
145
+ #pragma mark -
146
+
147
+ - (void)showPicker:(UIView *)picker
148
+ {
149
+ // hide the current picker and show the new one
150
+ if (currentPicker)
151
+ {
152
+ currentPicker.hidden = YES;
153
+ label.text = @"";
154
+ }
155
+ picker.hidden = NO;
156
+
157
+ currentPicker = picker; // remember the current picker so we can remove it later when another one is chosen
158
+ }
159
+
160
+ - (void)viewDidLoad
161
+ {
162
+ [super viewDidLoad];
163
+
164
+ self.title = NSLocalizedString(@"PickerTitle", @"");
165
+
166
+ [self createPicker];
167
+ [self createDatePicker];
168
+ [self createCustomPicker];
169
+
170
+ // tint the bottom toolbar's segmented control with dark grey
171
+ buttonBarSegmentedControl.tintColor = [UIColor darkGrayColor];
172
+
173
+ // tint the date picker style segmented control with dark grey
174
+ pickerStyleSegmentedControl.tintColor = [UIColor darkGrayColor];
175
+
176
+ // label for picker selection output, place it right above the picker
177
+ CGRect labelFrame = CGRectMake( kLeftMargin,
178
+ myPickerView.frame.origin.y - kTextFieldHeight,
179
+ self.view.bounds.size.width - (kRightMargin * 2.0),
180
+ kTextFieldHeight);
181
+ self.label = [[[UILabel alloc] initWithFrame:labelFrame] autorelease];
182
+ self.label.font = [UIFont systemFontOfSize: 14];
183
+ self.label.textAlignment = UITextAlignmentCenter;
184
+ self.label.textColor = [UIColor whiteColor];
185
+ self.label.backgroundColor = [UIColor clearColor];
186
+ [self.view addSubview:self.label];
187
+
188
+ // start by showing the normal picker in date mode
189
+ buttonBarSegmentedControl.selectedSegmentIndex = 0;
190
+ datePickerView.datePickerMode = UIDatePickerModeDate;
191
+ }
192
+
193
+ // called after the view controller's view is released and set to nil.
194
+ // For example, a memory warning which causes the view to be purged. Not invoked as a result of -dealloc.
195
+ // So release any properties that are loaded in viewDidLoad or can be recreated lazily.
196
+ //
197
+ - (void)viewDidUnload
198
+ {
199
+ [super viewDidUnload];
200
+
201
+ // release and set out IBOutlets to nil
202
+ self.buttonBarSegmentedControl = nil;
203
+ self.pickerStyleSegmentedControl = nil;
204
+ self.segmentLabel = nil;
205
+
206
+ // release all the other objects
207
+ self.myPickerView = nil;
208
+ self.pickerViewArray = nil;
209
+
210
+ self.datePickerView = nil;
211
+
212
+ self.label = nil;
213
+
214
+ self.customPickerView = nil;
215
+ self.customPickerDataSource = nil;
216
+ }
217
+
218
+ - (void)dealloc
219
+ {
220
+ [pickerViewArray release];
221
+ [myPickerView release];
222
+ [datePickerView release];
223
+ [label release];
224
+
225
+ [customPickerDataSource release];
226
+ [customPickerView release];
227
+
228
+ [pickerStyleSegmentedControl release];
229
+ [segmentLabel release];
230
+
231
+ [buttonBarSegmentedControl release];
232
+
233
+ [super dealloc];
234
+ }
235
+
236
+ - (IBAction)togglePickerStyle:(id)sender
237
+ {
238
+ UISegmentedControl *segControl = sender;
239
+ switch (segControl.selectedSegmentIndex)
240
+ {
241
+ case 0: // Time
242
+ {
243
+ datePickerView.datePickerMode = UIDatePickerModeTime;
244
+ segmentLabel.text = @"UIDatePickerModeTime";
245
+ break;
246
+ }
247
+ case 1: // Date
248
+ {
249
+ datePickerView.datePickerMode = UIDatePickerModeDate;
250
+ segmentLabel.text = @"UIDatePickerModeDate";
251
+ break;
252
+ }
253
+ case 2: // Date & Time
254
+ {
255
+ datePickerView.datePickerMode = UIDatePickerModeDateAndTime;
256
+ segmentLabel.text = @"UIDatePickerModeDateAndTime";
257
+ break;
258
+ }
259
+ case 3: // Counter
260
+ {
261
+ datePickerView.datePickerMode = UIDatePickerModeCountDownTimer;
262
+ segmentLabel.text = @"UIDatePickerModeCountDownTimer";
263
+ break;
264
+ }
265
+ }
266
+
267
+ // in case we previously chose the Counter style picker, make sure
268
+ // the current date is restored
269
+ NSDate *today = [NSDate date];
270
+ datePickerView.date = today;
271
+ }
272
+
273
+ - (IBAction)togglePickers:(id)sender
274
+ {
275
+ UISegmentedControl *segControl = sender;
276
+ switch (segControl.selectedSegmentIndex)
277
+ {
278
+ case 0: // UIPickerView
279
+ {
280
+ pickerStyleSegmentedControl.hidden = YES;
281
+ segmentLabel.hidden = YES;
282
+ [self showPicker:myPickerView];
283
+ break;
284
+ }
285
+ case 1: // UIDatePicker
286
+ {
287
+ // start by showing the time picker
288
+
289
+ // initially set the picker style to "date" format
290
+ pickerStyleSegmentedControl.selectedSegmentIndex = 1;
291
+ datePickerView.datePickerMode = UIDatePickerModeDate;
292
+
293
+ pickerStyleSegmentedControl.hidden = NO;
294
+ segmentLabel.hidden = NO;
295
+ [self showPicker:datePickerView];
296
+ break;
297
+ }
298
+
299
+ case 2: // Custom
300
+ {
301
+ pickerStyleSegmentedControl.hidden = YES;
302
+ segmentLabel.hidden = YES;
303
+ [self showPicker:customPickerView];
304
+ break;
305
+ }
306
+ }
307
+ }
308
+
309
+
310
+ #pragma mark -
311
+ #pragma mark UIPickerViewDelegate
312
+
313
+ - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
314
+ {
315
+ if (pickerView == myPickerView) // don't show selection for the custom picker
316
+ {
317
+ // report the selection to the UI label
318
+ label.text = [NSString stringWithFormat:@"%@ - %d",
319
+ [pickerViewArray objectAtIndex:[pickerView selectedRowInComponent:0]],
320
+ [pickerView selectedRowInComponent:1]];
321
+ }
322
+ }
323
+
324
+
325
+ #pragma mark -
326
+ #pragma mark UIPickerViewDataSource
327
+
328
+ - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
329
+ {
330
+ NSString *returnStr = @"";
331
+
332
+ // note: custom picker doesn't care about titles, it uses custom views
333
+ if (pickerView == myPickerView)
334
+ {
335
+ if (component == 0)
336
+ {
337
+ returnStr = [pickerViewArray objectAtIndex:row];
338
+ }
339
+ else
340
+ {
341
+ returnStr = [[NSNumber numberWithInt:row] stringValue];
342
+ }
343
+ }
344
+
345
+ return returnStr;
346
+ }
347
+
348
+ - (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component
349
+ {
350
+ CGFloat componentWidth = 0.0;
351
+
352
+ if (component == 0)
353
+ componentWidth = 240.0; // first column size is wider to hold names
354
+ else
355
+ componentWidth = 40.0; // second column is narrower to show numbers
356
+
357
+ return componentWidth;
358
+ }
359
+
360
+ - (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component
361
+ {
362
+ return 40.0;
363
+ }
364
+
365
+ - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
366
+ {
367
+ return [pickerViewArray count];
368
+ }
369
+
370
+ - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
371
+ {
372
+ return 2;
373
+ }
374
+
375
+
376
+ #pragma mark -
377
+ #pragma mark UIViewController delegate methods
378
+
379
+ // called after this controller's view was dismissed, covered or otherwise hidden
380
+ - (void)viewWillDisappear:(BOOL)animated
381
+ {
382
+ currentPicker.hidden = YES;
383
+
384
+ // restore the nav bar and status bar color to default
385
+ self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
386
+ [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
387
+ }
388
+
389
+ // called after this controller's view will appear
390
+ - (void)viewWillAppear:(BOOL)animated
391
+ {
392
+ [self togglePickers:buttonBarSegmentedControl]; // make sure the last picker is still showing
393
+
394
+ // for aesthetic reasons (the background is black), make the nav bar black for this particular page
395
+ self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
396
+
397
+ // match the status bar with the nav bar
398
+ [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;
399
+ }
400
+
401
+ @end
402
+
data/app/Prefix.pch ADDED
@@ -0,0 +1,5 @@
1
+ #ifdef __OBJC__
2
+ #import <Foundation/Foundation.h>
3
+ #import <UIKit/UIKit.h>
4
+ #endif
5
+
data/app/ReadMe.txt ADDED
@@ -0,0 +1,82 @@
1
+ UICatalog
2
+ ==========
3
+
4
+ This sample is a catalog exhibiting many views and controls in the UIKit framework, along with their various properties and styles.
5
+ If you need code to create specific UI controls or views, refer to this sample and it should give you a good head start in building your user interface.
6
+ In most cases you can simply copy and paste the code snippets you need.
7
+ When images or custom views are used, accessibility code has been added. Using the iPhone Accessibility API enhances the user experience of VoiceOver users.
8
+
9
+
10
+ Build Requirements
11
+ Mac OS X 10.5.6 or later, iPhone OS 3.0 SDK
12
+
13
+
14
+ Runtime Requirements
15
+ Mac OS X 10.5.6 or later, iPhone OS 3.0 SDK
16
+
17
+
18
+ Using the Sample
19
+ Build and run the sample using Xcode 3.1.3. To run in the simulator, set the Active SDK to Simulator. To run on a device, set the Active SDK to the appropriate Device setting.
20
+
21
+ In most areas of this sample, as you see various UI elements, you will see a corresponding explanation as to where you can find the code. So for example the Buttons page - the gray button will have "ButtonsViewController.m - createGrayButton". This means refer to the ButtonsViewController.m source file and search for the createGrayButton Objective-C method.
22
+
23
+ Buttons - This UIViewController or page contains various kinds of UIButton controls complete with background images.
24
+
25
+ Controls - This page contains other miscellaneous UIControl classes helpful in building your user interface including switch, slider page, and progress indicator.
26
+
27
+ TextFields - This page hosts different kinds of UITextField controls. It also demonstrates how to handle the keyboard, particularly where text fields are placed.
28
+
29
+ SearchBar - This pages exhibits the UISearchBar control.
30
+
31
+ TextView - This page exhibits the use of UITextView.
32
+
33
+ Pickers - This page shows the varying picker style view including UIPickerView and UIDatePicker. UIDatePicker variants include date, time, date & time, as well as a counter. A custom picker is also included in this page.
34
+
35
+ Images - Shows how you can create a UIImageView containing a group of images used for animations or slide show.
36
+
37
+ Web - Shows how to properly use a UIWebView and target websites using NSURL class.
38
+
39
+ Segment - This page adds several types of UISegmentedControl views.
40
+
41
+ Toolbar - This page shows how to use UIToolbar and adds several kinds of UIBarButtonItems.
42
+
43
+ Alerts - This page shows how to use UIActionSheet and UIAlertView to display varying kinds of alerts that require user actions. This includes simple alerts, OK/Cancel alerts, and alerts with custom titled buttons.
44
+
45
+ Transitions - This page shows how to implement view "flipping" and "curl" animations between two different views using a category of UIView called UIViewAnimation.
46
+
47
+ Localization - You will notice this sample in various places shows you how to localize your string content by using the NSLocalizedString() macro. Each language has a "Localizeable.strings" file and this macro refers to this file when loading the strings.
48
+
49
+
50
+ Packaging List
51
+ main.m - Main source file for this sample.
52
+ AppDelegate.h/.m - The application's delegate to setup its window and content.
53
+ Contants.h - Contains various screen placement constants used across all the UIViewControllers.
54
+
55
+ MainViewController.h/.m - The front UIViewController containing a UITableView to navigate to all its pages.
56
+ ButtonsViewController.h/.m -UIViewController that hosts all the varying UIButtons.
57
+ ControlsViewController.h/.m - UIViewController that hosts all the varying UIControls.
58
+ TextFieldViewController.h/.m - UIViewController that contains UITextFields and how to use them.
59
+ SearchBarController.h/.m - UIViewController that contains a UISearchBar.
60
+ TextViewController.h/.m - UIViewController that shows how to use UITextView.
61
+ PickerViewController.h/.m - UIViewController that shows all the different kinds of picker controls.
62
+ ImagesViewController.h/.m - UIViewController that contains a UIImageView.
63
+ WebViewController.h/.m - UIViewController that shows how to use UIWebView.
64
+ AlertsViewController.h/.m - UIViewController that hosts all the varying kinds of alerts and action sheets.
65
+ SegmentViewController.h/.m - UIViewController that hosts all the varying UISegmentedControls.
66
+ ToolbarViewController.h/.m - UIViewController that hosts a UIToolbar and its UIBarButtonItems.
67
+ TransitionViewController.h/.m - UIViewController that shows how to flip between two different views.
68
+
69
+ Changes from Previous Versions
70
+ 1.0 - First release
71
+ 1.1 - Updated the user interface layout to show proper use or proper context in using the UIKit controls and views.
72
+ 1.2 - Changes due to API updates in the Beta 3 SDK: reusable UITableView cells.
73
+ 1.3 - Updated for Beta 4, changed to use Interface Builder xib files, removed un-needed QuartzCore framework, added Toolbar view for UIToolbar and UIBarButtonItems, added additional UIButtonTypes, added UISearchBar.
74
+ 1.4 - Updated for Beta 5, renamed some classes.
75
+ 1.5 - Beta 6 Release, updated to use xib file for MainViewController, fixed bad blur effect on UIView classes by properly rounding of coordinates, introduced "UIViewAnimationTransitionCurlUp/UIViewAnimationTransitionCurlDown" UIView transitions, adopted UITextField's "leftView" property.
76
+ 1.6 - Minor UI modifications, changed bundle identifier.
77
+ 1.7 - Improved custom UIPicker, Updated for and tested with iPhone OS 2.0. First public release.
78
+ 2.0 - Upgraded for 3.0 SDK due to deprecated APIs, more use of UITableViewController.
79
+ 2.5 - Minor bug fixes, all view controllers created from separate nibs, more use of properties, further code optimizations, added viewDidUnload methods.
80
+ 2.6 - Used the iPhone Accessibility API to improve the accessibility of UICatalog and demonstrate how accessibility should be employed.
81
+
82
+ Copyright (C) 2008-2009 Apple Inc. All rights reserved.
@@ -0,0 +1,58 @@
1
+ /*
2
+ File: SearchBarController.h
3
+ Abstract: The view controller for hosting the UISearchBar 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 SearchBarController : UIViewController <UISearchBarDelegate>
51
+ {
52
+ UISearchBar *mySearchBar;
53
+ }
54
+
55
+ @property (nonatomic, retain) UISearchBar *mySearchBar;
56
+
57
+ @end
58
+