iCuke 0.5.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/README.rdoc +8 -7
- data/Rakefile +10 -30
- data/VERSION +1 -1
- data/app/.gitignore +3 -0
- data/app/LICENSE +20 -0
- data/app/Readme.markdown +3 -0
- data/app/Shared/AppDelegate_Shared.h +17 -0
- data/app/Shared/AppDelegate_Shared.m +25 -0
- data/app/{images/yellowslide.png → Shared/Icon.png} +0 -0
- data/app/Shared/ModalViewController.h +15 -0
- data/app/Shared/ModalViewController.m +96 -0
- data/app/Shared/TestViewController_Shared.h +15 -0
- data/app/Shared/TestViewController_Shared.m +43 -0
- data/app/{Info.plist → Shared/Universal-Info.plist} +17 -4
- data/app/Shared/Universal_Prefix.pch +8 -0
- data/app/Shared/main.m +14 -0
- data/app/Universal.xcodeproj/project.pbxproj +301 -0
- data/app/iPad/AppDelegate_Pad.h +15 -0
- data/app/iPad/AppDelegate_Pad.m +28 -0
- data/app/iPad/Default-Landscape.png +0 -0
- data/app/iPad/Default-Portrait.png +0 -0
- data/app/iPad/MainWindow_Pad.xib +343 -0
- data/app/iPad/TestViewController_Pad.h +15 -0
- data/app/iPad/TestViewController_Pad.m +52 -0
- data/app/iPhone/AppDelegate_Phone.h +15 -0
- data/app/iPhone/AppDelegate_Phone.m +28 -0
- data/app/{images/segment_search.png → iPhone/Default.png} +0 -0
- data/app/iPhone/MainWindow_Phone.xib +363 -0
- data/app/iPhone/TestViewController_Phone.h +15 -0
- data/app/iPhone/TestViewController_Phone.m +36 -0
- data/bin/.gitignore +1 -0
- data/bin/icuke +10 -0
- data/bin/icuke-module +17 -0
- data/ext/.gitignore +1 -0
- data/ext/Rakefile +6 -0
- data/ext/WaxSim/Simulator.h +31 -0
- data/ext/WaxSim/Simulator.m +131 -0
- data/ext/WaxSim/WaxSim.m +110 -0
- data/ext/WaxSim/WaxSim.xcodeproj/project.pbxproj +238 -0
- data/ext/WaxSim/WaxSim_Prefix.pch +7 -0
- data/ext/WaxSim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h +126 -0
- data/ext/iCuke/Rakefile +14 -17
- data/ext/iCuke/libicuke-sdk3.1.dylib +0 -0
- data/ext/iCuke/libicuke-sdk4.0.dylib +0 -0
- data/ext/iCuke/libicuke.dylib +0 -0
- data/ext/iCuke/{DefaultsResponse.h → sdk3.1/DefaultsResponse.h} +0 -0
- data/ext/iCuke/{DefaultsResponse.m → sdk3.1/DefaultsResponse.m} +0 -0
- data/ext/iCuke/{EventResponse.h → sdk3.1/EventResponse.h} +0 -0
- data/ext/iCuke/{EventResponse.m → sdk3.1/EventResponse.m} +0 -0
- data/ext/iCuke/sdk3.1/ModuleResponse.h +5 -0
- data/ext/iCuke/sdk3.1/ModuleResponse.m +76 -0
- data/ext/iCuke/sdk3.1/Rakefile +20 -0
- data/ext/iCuke/{Recorder.h → sdk3.1/Recorder.h} +0 -0
- data/ext/iCuke/{Recorder.m → sdk3.1/Recorder.m} +0 -0
- data/ext/iCuke/{RecorderResponse.h → sdk3.1/RecorderResponse.h} +0 -0
- data/ext/iCuke/{RecorderResponse.m → sdk3.1/RecorderResponse.m} +0 -0
- data/ext/iCuke/{SynthesizeSingleton.h → sdk3.1/SynthesizeSingleton.h} +0 -0
- data/ext/iCuke/{ViewResponse.h → sdk3.1/ViewResponse.h} +0 -0
- data/ext/iCuke/{ViewResponse.m → sdk3.1/ViewResponse.m} +0 -0
- data/ext/iCuke/{Viewer.h → sdk3.1/Viewer.h} +0 -0
- data/ext/iCuke/sdk3.1/Viewer.m +203 -0
- data/ext/iCuke/{iCukeHTTPResponseHandler.h → sdk3.1/iCukeHTTPResponseHandler.h} +0 -0
- data/ext/iCuke/{iCukeHTTPResponseHandler.m → sdk3.1/iCukeHTTPResponseHandler.m} +0 -0
- data/ext/iCuke/{iCukeHTTPServer.h → sdk3.1/iCukeHTTPServer.h} +0 -0
- data/ext/iCuke/{iCukeHTTPServer.m → sdk3.1/iCukeHTTPServer.m} +0 -0
- data/ext/iCuke/{iCukeServer.h → sdk3.1/iCukeServer.h} +0 -2
- data/ext/iCuke/{iCukeServer.m → sdk3.1/iCukeServer.m} +22 -20
- data/ext/iCuke/{json → sdk3.1/json}/JSON.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/NSObject+SBJSON.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/NSObject+SBJSON.m +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/NSString+SBJSON.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/NSString+SBJSON.m +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJSON.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJSON.m +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonBase.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonBase.m +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonParser.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonParser.m +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonWriter.h +0 -0
- data/ext/iCuke/{json → sdk3.1/json}/SBJsonWriter.m +0 -0
- data/ext/iCuke/sdk4.0/DefaultsResponse.h +5 -0
- data/ext/iCuke/sdk4.0/DefaultsResponse.m +66 -0
- data/ext/iCuke/sdk4.0/EventResponse.h +5 -0
- data/ext/iCuke/sdk4.0/EventResponse.m +130 -0
- data/ext/iCuke/sdk4.0/ModuleResponse.h +5 -0
- data/ext/iCuke/sdk4.0/ModuleResponse.m +76 -0
- data/ext/iCuke/sdk4.0/Rakefile +20 -0
- data/ext/iCuke/sdk4.0/Recorder.h +17 -0
- data/ext/iCuke/sdk4.0/Recorder.m +90 -0
- data/ext/iCuke/sdk4.0/RecorderResponse.h +6 -0
- data/ext/iCuke/sdk4.0/RecorderResponse.m +68 -0
- data/ext/iCuke/sdk4.0/SynthesizeSingleton.h +68 -0
- data/ext/iCuke/sdk4.0/ViewResponse.h +5 -0
- data/ext/iCuke/sdk4.0/ViewResponse.m +84 -0
- data/ext/iCuke/sdk4.0/Viewer.h +8 -0
- data/ext/iCuke/{Viewer.m → sdk4.0/Viewer.m} +14 -0
- data/ext/iCuke/sdk4.0/iCukeHTTPResponseHandler.h +50 -0
- data/ext/iCuke/sdk4.0/iCukeHTTPResponseHandler.m +381 -0
- data/ext/iCuke/sdk4.0/iCukeHTTPServer.h +53 -0
- data/ext/iCuke/sdk4.0/iCukeHTTPServer.m +365 -0
- data/ext/iCuke/sdk4.0/iCukeServer.h +14 -0
- data/ext/iCuke/sdk4.0/iCukeServer.m +65 -0
- data/ext/iCuke/sdk4.0/json/JSON.h +50 -0
- data/ext/iCuke/sdk4.0/json/NSObject+SBJSON.h +68 -0
- data/ext/iCuke/sdk4.0/json/NSObject+SBJSON.m +53 -0
- data/ext/iCuke/sdk4.0/json/NSString+SBJSON.h +58 -0
- data/ext/iCuke/sdk4.0/json/NSString+SBJSON.m +55 -0
- data/ext/iCuke/sdk4.0/json/SBJSON.h +75 -0
- data/ext/iCuke/sdk4.0/json/SBJSON.m +212 -0
- data/ext/iCuke/sdk4.0/json/SBJsonBase.h +86 -0
- data/ext/iCuke/sdk4.0/json/SBJsonBase.m +78 -0
- data/ext/iCuke/sdk4.0/json/SBJsonParser.h +87 -0
- data/ext/iCuke/sdk4.0/json/SBJsonParser.m +475 -0
- data/ext/iCuke/sdk4.0/json/SBJsonWriter.h +129 -0
- data/ext/iCuke/sdk4.0/json/SBJsonWriter.m +228 -0
- data/features/iphone.feature +15 -0
- data/features/support/env.rb +1 -1
- data/iCuke.gemspec +118 -114
- data/lib/icuke/cucumber.rb +93 -64
- data/lib/icuke/screen.rb +110 -0
- data/lib/icuke/sdk.rb +134 -0
- data/lib/icuke/simulate.rb +9 -5
- data/lib/icuke/simulator.rb +10 -11
- data/lib/icuke/waxsim.rb +36 -0
- data/lib/icuke.rb +2 -1
- metadata +124 -129
- data/app/AlertsViewController.h +0 -59
- data/app/AlertsViewController.m +0 -341
- data/app/AppDelegate.h +0 -60
- data/app/AppDelegate.m +0 -101
- data/app/ButtonsViewController.h +0 -80
- data/app/ButtonsViewController.m +0 -448
- data/app/Constants.h +0 -58
- data/app/ControlsViewController.h +0 -72
- data/app/ControlsViewController.m +0 -379
- data/app/ImagesViewController.h +0 -62
- data/app/ImagesViewController.m +0 -137
- data/app/MainViewController.h +0 -57
- data/app/MainViewController.m +0 -262
- data/app/Picker/CustomPickerDataSource.h +0 -55
- data/app/Picker/CustomPickerDataSource.m +0 -135
- data/app/Picker/CustomView.h +0 -62
- data/app/Picker/CustomView.m +0 -119
- data/app/PickerViewController.h +0 -88
- data/app/PickerViewController.m +0 -402
- data/app/Prefix.pch +0 -5
- data/app/ReadMe.txt +0 -82
- data/app/SearchBarController.h +0 -58
- data/app/SearchBarController.m +0 -105
- data/app/SegmentViewController.h +0 -54
- data/app/SegmentViewController.m +0 -195
- data/app/TextFieldController.h +0 -67
- data/app/TextFieldController.m +0 -342
- data/app/TextViewController.h +0 -57
- data/app/TextViewController.m +0 -164
- data/app/ToolbarViewController.h +0 -74
- data/app/ToolbarViewController.m +0 -303
- data/app/TransitionViewController.h +0 -64
- data/app/TransitionViewController.m +0 -178
- data/app/UICatalog.xcodeproj/project.pbxproj +0 -615
- data/app/WebViewController.h +0 -57
- data/app/WebViewController.m +0 -173
- data/app/en.lproj/AlertsViewController.xib +0 -144
- data/app/en.lproj/ButtonsViewController.xib +0 -147
- data/app/en.lproj/ControlsViewController.xib +0 -147
- data/app/en.lproj/ImagesViewController.xib +0 -264
- data/app/en.lproj/Localizable.strings +0 -41
- data/app/en.lproj/MainWindow.xib +0 -306
- data/app/en.lproj/PickerViewController.xib +0 -415
- data/app/en.lproj/SearchBarController.xib +0 -142
- data/app/en.lproj/SegmentViewController.xib +0 -143
- data/app/en.lproj/TextFieldController.xib +0 -167
- data/app/en.lproj/TextViewController.xib +0 -149
- data/app/en.lproj/ToolbarViewController.xib +0 -491
- data/app/en.lproj/TransitionViewController.xib +0 -255
- data/app/en.lproj/WebViewController.xib +0 -141
- 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_tools.png +0 -0
- data/app/images/slider_ball.png +0 -0
- data/app/images/whiteButton.png +0 -0
- data/app/main.m +0 -58
- data/features/uicatalog.feature +0 -20
- data/lib/icuke/com.apple.Accessibility.plist +0 -0
- data/lib/icuke/headless.rb +0 -54
- data/lib/icuke/xcode.rb +0 -164
data/app/ButtonsViewController.m
DELETED
@@ -1,448 +0,0 @@
|
|
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
DELETED
@@ -1,58 +0,0 @@
|
|
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
|
@@ -1,72 +0,0 @@
|
|
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
|
-
|