Skip to content

Instantly share code, notes, and snippets.

@DmitrySkiba
Created January 15, 2012 07:54
Show Gist options
  • Save DmitrySkiba/1614967 to your computer and use it in GitHub Desktop.
Save DmitrySkiba/1614967 to your computer and use it in GitHub Desktop.
Simple iOS app (from Itoa tutorial)
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/*
* ApplicationDelegate
*/
@interface ApplicationDelegate: NSObject<UIApplicationDelegate> {
UIWindow* m_window;
}
@end
@implementation ApplicationDelegate
-(void)dealloc {
[m_window release];
[super dealloc];
}
-(void)applicationDidFinishLaunching:(UIApplication*)application {
CGRect bounds=[[UIScreen mainScreen] bounds];
UIWindow* window=[[UIWindow alloc] initWithFrame:bounds];
window.backgroundColor=[UIColor darkGrayColor];
UILabel* label=[[UILabel alloc] init];
label.text=@"Hello iOS!";
label.frame=CGRectMake(0,0,150,50);
label.center=window.center;
label.textAlignment=UITextAlignmentCenter;
[window addSubview:label];
[window makeKeyAndVisible];
m_window=window;
}
@end
/*
* main
*/
int main(int argc,char* argv[]) {
NSAutoreleasePool* pool=[[NSAutoreleasePool alloc] init];
UIApplicationMain(argc,argv,NULL,@"ApplicationDelegate");
[pool release];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment