Adds iOS files for crossplatform calculator example.

This commit is contained in:
Grzegorz Adam Hankiewicz 2012-09-07 10:14:09 +02:00
commit ca0c001345
9 changed files with 494 additions and 0 deletions

View file

@ -0,0 +1,7 @@
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

View file

@ -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

View file

@ -0,0 +1,10 @@
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

View file

@ -0,0 +1,13 @@
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#import "backend.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
NimMain();
return UIApplicationMain(argc, argv, nil,
NSStringFromClass([AppDelegate class]));
}
}