I've been looking at the OC Foundation for two days before I started to get the demo on iOS. Now more study materials are xcode4.x, found that xCode6.1 still changed a lot of things, a lot of functions need to understand, probably is the pain and happy, the big God can directly ignore me, all the time is the development, concrete look at the figure analysis:
1. Create a new single view file:
2. New project name, language selection OC:
3. This is to drag two controls on the view above, one of which is better than Android is not necessary to create a new simulator, cancel the auto layout and auto size classes, otherwise the page is very large:
4. If you simply write a Hello world, the program is over, but for the first time, it's an event:
5. The novice error is the ' not ' key value coding-compliant for the key result, which is connected too much, even wrong, the result of the connection there is no deletion, the specific changes are as follows:
6. The operating effect is as follows:
7. The code is as follows:
Code in ViewController.h:
viewcontroller.h// demo01//// Created by Keso on 15/1/12.// Copyright (c) 2015 Keso. All rights reserved.//#import <UIKit/UIKit.h> @interface viewcontroller:uiviewcontroller@property (Weak, nonatomic) Iboutlet UIView *name; @property (weak, nonatomic) Iboutlet Uitextfield *realname; @property (weak, nonatomic) I Boutlet UILabel *result; @end
Code in VIEWCONTROLLER.M:
viewcontroller.m// demo01//// Created by Keso on 15/1/12.// Copyright (c) 2015 Keso. All rights reserved.//#import "ViewController.h" @interface Viewcontroller () @end @implementation viewcontroller-(void ) Viewdidload { [super viewdidload]; Do any additional setup after loading the view, typically from a nib.} -(void) didreceivememorywarning { [super didreceivememorywarning]; Dispose of any resources the can be recreated.} -(Ibaction) ShowName: (ID) Sender { nsstring *textname=[_realname text]; [_result settext:textname];} @end
iOS Development First Experience Demo