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,105 @@
1
+ /*
2
+ File: SearchBarController.m
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 "SearchBarController.h"
49
+
50
+ @implementation SearchBarController
51
+
52
+ @synthesize mySearchBar;
53
+
54
+ - (void)dealloc
55
+ {
56
+ [mySearchBar release];
57
+ [super dealloc];
58
+ }
59
+
60
+ - (void)viewDidLoad
61
+ {
62
+ [super viewDidLoad];
63
+
64
+ self.title = NSLocalizedString(@"SearchBarTitle", @"");
65
+
66
+ self.view.backgroundColor = [UIColor groupTableViewBackgroundColor]; // use the table view background color
67
+
68
+ self.mySearchBar = [[[UISearchBar alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, 44.0)] autorelease];
69
+ self.mySearchBar.delegate = self;
70
+ self.mySearchBar.showsCancelButton = YES;
71
+
72
+ // note: here you can also change its "tintColor" property to a different UIColor
73
+
74
+ [self.view addSubview: self.mySearchBar];
75
+ }
76
+
77
+ // called after the view controller's view is released and set to nil.
78
+ // For example, a memory warning which causes the view to be purged. Not invoked as a result of -dealloc.
79
+ // So release any properties that are loaded in viewDidLoad or can be recreated lazily.
80
+ //
81
+ - (void)viewDidUnload
82
+ {
83
+ [super viewDidUnload];
84
+
85
+ // release and set to nil
86
+ self.mySearchBar = nil;
87
+ }
88
+
89
+
90
+ #pragma mark -
91
+ #pragma mark UISearchBarDelegate
92
+
93
+ // called when keyboard search button pressed
94
+ - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
95
+ {
96
+ [self.mySearchBar resignFirstResponder];
97
+ }
98
+
99
+ // called when cancel button pressed
100
+ - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
101
+ {
102
+ [self.mySearchBar resignFirstResponder];
103
+ }
104
+
105
+ @end
@@ -0,0 +1,54 @@
1
+ /*
2
+ File: SegmentViewController.h
3
+ Abstract: The view controller for hosting the UISegmentedControl 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 SegmentViewController : UIViewController
51
+ {
52
+ }
53
+
54
+ @end
@@ -0,0 +1,195 @@
1
+ /*
2
+ File: SegmentViewController.m
3
+ Abstract: The view controller for hosting the UISegmentedControl 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 "SegmentViewController.h"
49
+ #import "Constants.h"
50
+
51
+ #define kSegmentedControlHeight 40.0
52
+ #define kLabelHeight 20.0
53
+
54
+ @implementation SegmentViewController
55
+
56
+ + (UILabel *)labelWithFrame:(CGRect)frame title:(NSString *)title
57
+ {
58
+ UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
59
+
60
+ label.textAlignment = UITextAlignmentLeft;
61
+ label.text = title;
62
+ label.font = [UIFont boldSystemFontOfSize:17.0];
63
+ label.textColor = [UIColor colorWithRed:76.0/255.0 green:86.0/255.0 blue:108.0/255.0 alpha:1.0];
64
+ label.backgroundColor = [UIColor clearColor];
65
+
66
+ return label;
67
+ }
68
+
69
+ - (void)createControls
70
+ {
71
+ NSArray *segmentTextContent = [NSArray arrayWithObjects: @"Check", @"Search", @"Tools", nil];
72
+
73
+ // label
74
+ CGFloat yPlacement = kTopMargin;
75
+ CGRect frame = CGRectMake(kLeftMargin, yPlacement, self.view.bounds.size.width - (kRightMargin * 2.0), kLabelHeight);
76
+ [self.view addSubview:[SegmentViewController labelWithFrame:frame title:@"UISegmentedControl:"]];
77
+
78
+ #pragma mark -
79
+ #pragma mark UISegmentedControl
80
+ UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:
81
+ [NSArray arrayWithObjects:
82
+ [UIImage imageNamed:@"segment_check.png"],
83
+ [UIImage imageNamed:@"segment_search.png"],
84
+ [UIImage imageNamed:@"segment_tools.png"],
85
+ nil]];
86
+ yPlacement += kTweenMargin + kLabelHeight;
87
+ frame = CGRectMake( kLeftMargin,
88
+ yPlacement,
89
+ self.view.bounds.size.width - (kRightMargin * 2.0),
90
+ kSegmentedControlHeight);
91
+ segmentedControl.frame = frame;
92
+ [segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
93
+ segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
94
+ segmentedControl.selectedSegmentIndex = 1;
95
+ [self.view addSubview:segmentedControl];
96
+ [segmentedControl release];
97
+
98
+ // Add the appropriate accessibility label to each image.
99
+ [[segmentedControl imageForSegmentAtIndex:0] setAccessibilityLabel:NSLocalizedString(@"CheckMarkIcon", @"")];
100
+ [[segmentedControl imageForSegmentAtIndex:1] setAccessibilityLabel:NSLocalizedString(@"SearchIcon", @"")];
101
+ [[segmentedControl imageForSegmentAtIndex:2] setAccessibilityLabel:NSLocalizedString(@"ToolsIcon", @"")];
102
+
103
+ // label
104
+ yPlacement += (kTweenMargin * 2.0) + kSegmentedControlHeight;
105
+ frame = CGRectMake( kLeftMargin,
106
+ yPlacement,
107
+ self.view.bounds.size.width - (kRightMargin * 2.0),
108
+ kLabelHeight);
109
+ [self.view addSubview:[SegmentViewController labelWithFrame:frame title:@"UISegmentControlStyleBordered:"]];
110
+
111
+ #pragma mark -
112
+ #pragma mark UISegmentControlStyleBordered
113
+ segmentedControl = [[UISegmentedControl alloc] initWithItems:segmentTextContent];
114
+ yPlacement += kTweenMargin + kLabelHeight;
115
+ frame = CGRectMake( kLeftMargin,
116
+ yPlacement,
117
+ self.view.bounds.size.width - (kRightMargin * 2.0),
118
+ kSegmentedControlHeight);
119
+ segmentedControl.frame = frame;
120
+ [segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
121
+ segmentedControl.segmentedControlStyle = UISegmentedControlStyleBordered;
122
+ segmentedControl.selectedSegmentIndex = 1;
123
+
124
+ [self.view addSubview:segmentedControl];
125
+ [segmentedControl release];
126
+
127
+ // label
128
+ yPlacement += (kTweenMargin * 2.0) + kSegmentedControlHeight;
129
+ frame = CGRectMake( kLeftMargin,
130
+ yPlacement,
131
+ self.view.bounds.size.width - (kRightMargin * 2.0),
132
+ kLabelHeight);
133
+ [self.view addSubview:[SegmentViewController labelWithFrame:frame title:@"UISegmentControlStyleBar:"]];
134
+
135
+ #pragma mark -
136
+ #pragma mark UISegmentControlStyleBar
137
+ yPlacement += kTweenMargin + kLabelHeight;
138
+ segmentedControl = [[UISegmentedControl alloc] initWithItems:segmentTextContent];
139
+ frame = CGRectMake( kLeftMargin,
140
+ yPlacement,
141
+ self.view.bounds.size.width - (kRightMargin * 2.0),
142
+ kSegmentedControlHeight);
143
+ segmentedControl.frame = frame;
144
+ [segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
145
+ segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
146
+ segmentedControl.selectedSegmentIndex = 1;
147
+
148
+ [self.view addSubview:segmentedControl];
149
+ [segmentedControl release];
150
+
151
+ // label
152
+ yPlacement += (kTweenMargin * 2.0) + kSegmentedControlHeight;
153
+ frame = CGRectMake( kLeftMargin,
154
+ yPlacement,
155
+ self.view.bounds.size.width,
156
+ kLabelHeight);
157
+ [self.view addSubview:[SegmentViewController labelWithFrame:frame title:@"UISegmentControlStyleBar: (tinted)"]];
158
+
159
+ #pragma mark -
160
+ #pragma mark UISegmentedControl (red-tinted)
161
+ segmentedControl = [[UISegmentedControl alloc] initWithItems:segmentTextContent];
162
+ yPlacement += kTweenMargin + kLabelHeight;
163
+ frame = CGRectMake( kLeftMargin,
164
+ yPlacement,
165
+ self.view.bounds.size.width - (kRightMargin * 2.0),
166
+ kSegmentedControlHeight);
167
+ segmentedControl.frame = frame;
168
+ [segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
169
+ segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
170
+ segmentedControl.tintColor = [UIColor colorWithRed:0.70 green:0.171 blue:0.1 alpha:1.0];
171
+ segmentedControl.selectedSegmentIndex = 1;
172
+
173
+ [self.view addSubview:segmentedControl];
174
+ [segmentedControl release];
175
+ #pragma mark -
176
+ }
177
+
178
+ - (void)viewDidLoad
179
+ {
180
+ [super viewDidLoad];
181
+
182
+ self.title = NSLocalizedString(@"SegmentTitle", @"");
183
+
184
+ self.view.backgroundColor = [UIColor groupTableViewBackgroundColor]; // use the table view background color
185
+
186
+ [self createControls]; // create the showcase of controls
187
+ }
188
+
189
+ - (void)segmentAction:(id)sender
190
+ {
191
+ //NSLog(@"segmentAction: selected segment = %d", [sender selectedSegmentIndex]);
192
+ }
193
+
194
+ @end
195
+
@@ -0,0 +1,67 @@
1
+ /*
2
+ File: TextFieldController.h
3
+ Abstract: The view controller for hosting the UITextField 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 TextFieldController : UITableViewController <UITextFieldDelegate>
51
+ {
52
+ UITextField *textFieldNormal;
53
+ UITextField *textFieldRounded;
54
+ UITextField *textFieldSecure;
55
+ UITextField *textFieldLeftView;
56
+
57
+ NSArray *dataSourceArray;
58
+ }
59
+
60
+ @property (nonatomic, retain, readonly) UITextField *textFieldNormal;
61
+ @property (nonatomic, retain, readonly) UITextField *textFieldRounded;
62
+ @property (nonatomic, retain, readonly) UITextField *textFieldSecure;
63
+ @property (nonatomic, retain, readonly) UITextField *textFieldLeftView;
64
+
65
+ @property (nonatomic, retain) NSArray *dataSourceArray;
66
+
67
+ @end