commit 9e498ad7c8f3083d77c9ed60433ca128334c4f4b
parent d6541baa0f7b7b3e2b3d05327f80b6d32b9d6239
Author: Kyle Milz <kyle@getaddrinfo.net>
Date: Sun, 24 May 2015 02:21:42 -0600
ios: hello world from an iphone
Diffstat:
4 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/ios/Makefile b/ios/Makefile
@@ -0,0 +1,17 @@
+#
+# the sdk needs to be unpacked and ready to go before running this, see
+# http://iphonedevwiki.net/index.php/Compiling_iOS_applications_on-device
+# for more information
+#
+
+build: main.m TestLabel.m
+ clang -isysroot /var/sdks/Latest.sdk -c main.m
+ clang -isysroot /var/sdks/Latest.sdk -c TestLabel.m
+ clang -isysroot /var/sdks/Latest.sdk -framework Foundation \
+ -framework UIKit main.o TestLabel.o -o Shist
+
+install: build
+ cp Shist /Applications/Shist.app/
+
+clean:
+ rm -f *.o Shist
diff --git a/ios/TestLabel.h b/ios/TestLabel.h
@@ -0,0 +1,5 @@
+#import <UIKit/UIKit.h>
+
+@interface TestLabel : UILabel
+-(instancetype)initWithBackgroundColor:(UIColor *)backgroundColor;
+@end
diff --git a/ios/TestLabel.m b/ios/TestLabel.m
@@ -0,0 +1,15 @@
+#import "TestLabel.h"
+
+@implementation TestLabel
+-(instancetype)initWithBackgroundColor:(UIColor *)backgroundColor
+{
+ if(self == [self init])
+ {
+ self.backgroundColor = backgroundColor;
+ self.textColor = UIColor.whiteColor;
+ self.text = @"rofl";
+ self.frame = CGRectMake(20,20,300,300);
+ }
+ return self;
+}
+@end
diff --git a/ios/main.m b/ios/main.m
@@ -0,0 +1,33 @@
+#import <UIKit/UIKit.h>
+#import "TestLabel.h"
+
+@interface TestAppDelegate : UIResponder <UIApplicationDelegate>
+@property (nonatomic, strong) UIWindow *window;
+@end
+
+int main(int argc, char *argv[])
+{
+ @autoreleasepool
+ {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass(TestAppDelegate.class));
+ }
+}
+
+@implementation TestAppDelegate
+@synthesize window=_window;
+
+-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ self.window = [UIWindow.alloc initWithFrame:UIScreen.mainScreen.bounds];
+ self.window.backgroundColor = UIColor.redColor;
+
+ UILabel *label = [[TestLabel alloc] initWithBackgroundColor:self.window.backgroundColor];
+ [self.window addSubview:label];
+ [label release];
+
+ [self.window makeKeyAndVisible];
+
+ return true;
+}
+
+@end