1 /* UIKit Tools - command-line utilities for UIKit
2 * Copyright (C) 2008-2012 Jay Freeman (saurik)
5 /* Modified BSD License {{{ */
7 * Redistribution and use in source and binary
8 * forms, with or without modification, are permitted
9 * provided that the following conditions are met:
11 * 1. Redistributions of source code must retain the
12 * above copyright notice, this list of conditions
13 * and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the
15 * above copyright notice, this list of conditions
16 * and the following disclaimer in the documentation
17 * and/or other materials provided with the
19 * 3. The name of the author may not be used to endorse
20 * or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
25 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
34 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
36 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 #import <Foundation/Foundation.h>
41 #import <UIKit/UIKit.h>
49 @interface AlertSheet : UIApplication
57 - (void) modalView:(UIModalView *)modalView didDismissWithButtonIndex:(NSInteger)buttonIndex;
59 - (void) alertSheet:(UIAlertSheet *)sheet buttonClicked:(int)button;
62 - (void) applicationDidFinishLaunching:(id)unused;
65 @implementation AlertSheet
68 - (void) modalView:(UIModalView *)modalView didDismissWithButtonIndex:(NSInteger)buttonIndex {
72 - (void) alertSheet:(UIAlertSheet *)alertSheet buttonClicked:(int)button {
78 - (void) applicationDidFinishLaunching:(id)unused {
79 NSMutableArray *buttons = [NSMutableArray arrayWithCapacity:(argc_ - 3)];
80 for (size_t i(0); i != argc_ - 3; ++i)
81 [buttons addObject:[NSString stringWithCString:argv_[i + 3]]];
84 UIAlertView *alert = [[[UIAlertView alloc]
85 initWithTitle:[NSString stringWithCString:argv_[1]]
86 message:[NSString stringWithCString:argv_[2]]
94 UIAlertSheet *sheet = [[[UIAlertSheet alloc]
95 initWithTitle:[NSString stringWithCString:argv_[1]]
102 [sheet setBodyText:[NSString stringWithCString:argv_[2]]];
104 [sheet setShowsOverSpringBoardAlerts:YES];
105 [sheet popupAlertAnimated:YES];
111 int main(int argc, char *argv[]) {
116 (char *) "AlertSheet", NULL
119 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
121 UIApplicationMain(1, args, nil, @"AlertSheet");
123 UIApplicationMain(1, args, [AlertSheet class]);