XCODE5 running in iphone retain 3.5 "mode (i.e. corresponding to iphone4, iphone4s) need to open arc
////main.m//Hello////Created by Lishujun on 14-8-28.//Copyright (c) 2014 Lishujun. All rights reserved.//#import<UIKit/UIKit.h>//View Controller Objects@interfaceHelloworldviewcontroller:uiviewcontroller@end@implementationHelloworldviewcontroller-(void) loadview{//Create a View objectUIView *contentview =[[UIView Alloc]initwithframe:[[uiscreen Mainscreen] applicationframe]; Contentview.backgroundcolor=[Uicolor Lightgraycolor]; Self.view=Contentview; //Create a Label objectUILabel *label = [[UILabel alloc]initwithframe:cgrectmake (0.0,0.0,320.0,30.0)]; Label.text=@"Hello World"; Label.center= Contentview.center;//Center VerticallyLabel.textalignment = Uitextalignmentcenter;//Center HorizontallyLabel.backgroundcolor =[Uicolor Clearcolor]; Label.textcolor=[Uicolor Redcolor]; //add a label to a view[Contentview Addsubview:label];}@end//Delegate Object@interfaceHelloworldappdelegate:nsobject <UIApplicationDelegate>{iboutlet UIWindow*window;} @property (nonatomic, retain) UIWindow*window;//must be declared as a property, declared as a local variable, cannot draw a view, display as a black screen@end@implementationhelloworldappdelegate@synthesizewindow;-(void) Applicationdidfinishlaunching: (UIApplication *) application{Self.window=[[UIWindow alloc] Initwithframe:[[uiscreen Mainscreen]bounds]]; Helloworldviewcontroller*viewcontroller =[[Helloworldviewcontroller alloc]init]; Self.window.rootViewController=Viewcontroller; [Self.window makekeyandvisible];}@end//Program EntryintMainintargcChar*argv[]) {@autoreleasepool {returnUiapplicationmain (argc, argv, Nil,@"helloworldappdelegate"); }}
iOS version Hello,world built entirely on the code