iOS開發初體驗Demo

來源:互聯網
上載者:User

標籤:

之前一直在看OC基礎,這兩天才開始弄iOS開發的Demo,現在更多的學習資料都是xCode4.X的,發現xCode6.1還是改動了不少東西,很多功能需要瞭解一下,大概就是痛並快樂著,大神可以直接忽略我了,說來說去都是開發,具體看圖分析:

1.建立單視圖檔案:

2.建立項目名稱,語言選擇OC:

3.這個就是拖了兩個控制項放在View上面的,其中有一個比Android好的就是不需要自己建立模擬器,取消一下自動布局和auto size classes,不然頁面很大:

4.如果你只是簡單的寫個Hello  World,那麼這個程式已經結束了,不過第一次還是做個事件:

5.新手錯誤之this class is not key value coding-compliant for the key result,這個就是連線連太多了,連錯了,結果串連那邊沒有刪除,具體修改如下:

6.運行效果如下:

7.代碼如下:

 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) IBOutlet UILabel *result;@end

 

 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 that can be recreated.}- (IBAction)showName:(id)sender {    NSString *textName=[_realName text];    [_result setText:textName];}@end

 

 

 

iOS開發初體驗Demo

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.