IOS development path-the first hello World project

Source: Internet
Author: User

First, create a blank iphone project:

Select the selected icon in the figure, and click next to go to the next step:

Name the project, and then click

Select the location you want to store and create it.

Then create a class to define the interface:

Select a class from the graph to create the class, and click Next.

Name the class and proceed to the next step

Select a path to create

The created Project is

Define the interface in the DemoViewController class: (most of the Code in the class is automatically generated, and only important code is written here)

/* DemoViewController. h */# import <UIKit/UIKit. h> @ interface DemoViewController: UIViewController {// defines a Label, which is used when the container UILabel * helloLabel;} // nonatomic: improves efficiency. The retain: setter method applies the old value of the parameter release, return the new value @ property (nonatomic, retain) UILabel * helloLabel; @ end

/* DemoViewController. m */# import "DemoViewController. h "@ implementation DemoViewController @ synthesize helloLabel; // pre-compiled // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. -(void) viewDidLoad {// CGRectMake (CGFloat x, CGFloat y, CGFloat width, CGFloat height) sets the Label display position // CGRectMake (distance from the left border, distance from the top border, Label length, Label height) helloLabel = [[UILabel alloc] initWithFrame: CGRectMake (0, 50,300, 60)]; // set helloLabel to display content in the Label. text = @ "Hello World"; // alignment Board (in the middle of a row) helloLabel. textAlignment = UITextAlignmentCenter; // set the font color to Red helloLabel. textColor = [UIColor redColor]; // set the font size to 20 helloLabel. font = [UIFont systemFontOfSize: 20]; // Add the Label to the View [self. view addSubview: helloLabel]; [super viewDidLoad];}

/* AppDelegate. h */# import <UIKit/UIKit. h> @ class DemoViewController; @ interface AppDelegate: UIResponder <response >{// create the DemoViewController class Object DemoViewController * _ iDemoViewController;} @ property (nonatomic, retain) DemoViewController * iDemoViewController; @ property (strong, nonatomic) UIWindow * window; @ end

/* Appdelegate. M */# import "appdelegate. H "# import" demoviewcontroller. H "@ implementation appdelegate // common understanding of the backup variable name: the role is to enable the compiler to use self @ synthesize window = _ window; @ synthesize idemoviewcontroller = _ idemoviewcontroller;-(void) dealloc {self. idemoviewcontroller = nil; [_ window release]; [Super dealloc];}-(bool) Application :( uiapplication *) Application didfinishlaunchingwitexceptions :( nsdictionary *) launchoptions {self. window = [[[uiwindow alloc] initwithframe: [[uiscreen mainscreen] bounds] autorelease]; // override point for customization after application launch. self. window. backgroundcolor = [uicolor whitecolor]; // create a temporary demo demoviewcontroller * demo = [[demoviewcontroller alloc] init]; self. idemoviewcontroller = demo; [demo release]; // release the temporary demo // Add it to window [self. window addsubview: Self. idemoviewcontroller. view]; [self. window makekeyandvisible]; return yes ;}

Then run the project to get the helloworld that we are particularly familiar with and are unfamiliar.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.