iphone第一個應用程式入門(標籤 iOS xcode4 mac objective-c cocoa)

來源:互聯網
上載者:User

1、首先建立項目,名字為slider:

開啟xcode:

選擇create a new Xcode project:

選擇Single View Application:


填寫product Name項目名字,Company Identifier公司標識,class Prefix,

關鍵是:Device Family選擇iPhone,然後選擇Next,Next完了以後選擇要存放的位置!

項目完成:接下來開啟:MainStoryboard.storyboard檔案:



請看右面的Objects,我直接拉了個Round Rect Button按鈕和一個Text Field文本,如,然後就給button按鈕添加了一個方法,添加回應程式法很簡單,右拉button按鈕到它右邊的TestViewController.h檔案,它就會自動產生方法,然後就是你在TestViewController.m檔案中實現方法,代碼如下 :

- (IBAction)hello:(id)sender {    static int i=0;    label.Text=[NSString stringWithFormat:@"renhaili%d",i];//把整形轉換成字串型    i++;}

,這樣運行結果如下:


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.