diff options
author | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2012-09-07 10:14:09 +0200 |
---|---|---|
committer | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2012-09-08 22:41:17 +0200 |
commit | ca0c00134580b59c65a9eedea88f201bd125970e (patch) | |
tree | 8ece4a08e317c32214119434b71d65391682b005 /examples/cross_calculator/ios/src/AppDelegate.m | |
parent | 116c54a8dd83c01a77d394f74bbe2372a8928cb8 (diff) | |
download | Nim-ca0c00134580b59c65a9eedea88f201bd125970e.tar.gz |
Adds iOS files for crossplatform calculator example.
Diffstat (limited to 'examples/cross_calculator/ios/src/AppDelegate.m')
-rw-r--r-- | examples/cross_calculator/ios/src/AppDelegate.m | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/examples/cross_calculator/ios/src/AppDelegate.m b/examples/cross_calculator/ios/src/AppDelegate.m new file mode 100644 index 000000000..d39a08b65 --- /dev/null +++ b/examples/cross_calculator/ios/src/AppDelegate.m @@ -0,0 +1,39 @@ +#import "AppDelegate.h" + +#import "backend.h" + +@implementation AppDelegate + +@synthesize window = _window; + +- (void)dealloc +{ + [_window release]; + [super dealloc]; +} + +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] + bounds]] autorelease]; + // Override point for customization after application launch. + self.window.backgroundColor = [UIColor whiteColor]; + [self.window makeKeyAndVisible]; + + // Call nimrod code and store the result. + const int a = 3; + const int b = 12; + const int c = myAdd(a, b); + + // Add a label to show the results of the computation made by nimrod. + UILabel *label = [[UILabel alloc] initWithFrame:self.window.bounds]; + label.textAlignment = UITextAlignmentCenter; + label.text = [NSString stringWithFormat:@"myAdd(%d, %d) = %d", a, b, c]; + [self.window addSubview:label]; + [label release]; + + return YES; +} + +@end |