Adds iOS files for crossplatform calculator example.
This commit is contained in:
parent
116c54a8dd
commit
ca0c001345
9 changed files with 494 additions and 0 deletions
7
examples/cross_calculator/ios/src/AppDelegate.h
Normal file
7
examples/cross_calculator/ios/src/AppDelegate.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
@end
|
||||
39
examples/cross_calculator/ios/src/AppDelegate.m
Normal file
39
examples/cross_calculator/ios/src/AppDelegate.m
Normal 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
|
||||
|
|
@ -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
|
||||
13
examples/cross_calculator/ios/src/main.m
Normal file
13
examples/cross_calculator/ios/src/main.m
Normal 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]));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue