<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                想必大家都閱讀過iphone4與ipad2開發基礎教程吧,這本書的xcode與現在的最新版本有些區別,去掉了view base application,只有比較接近的single view application. 首先我們創建一個single view application,注意這里我們不用自動引用計數。 接著我們點擊工程列表中的MainStoryboard_iphone.storyboard 來編輯界面: 我們創建兩個按鈕和一個用來輸出的空白文本: ![](https://box.kancloud.cn/2016-03-09_56dfc827d2f9a.png) 目錄結構與視圖結構: ![](https://box.kancloud.cn/2016-03-09_56dfc827e3941.png) 2.接著我們寫代碼來用來與IB界面編輯器來進行連接:在這里我們可以認為IBOutlet是與IB交互的輸出,而IBAction則是IB交互的事件。 先編寫ViewContoller.h: ~~~ #import <UIKit/UIKit.h> @interface ViewController : UIViewController { } @property (nonatomic,retain) IBOutlet UILabel * statusText; -(IBAction)buttonPressed:(id)sender; @end ~~~ 接著在ViewContoller.m來實現功能: ~~~ #import "ViewController.h" @implementation ViewController @synthesize statusText; -(IBAction)buttonPressed:(id)sender { NSString *title = [sender titleForState:UIControlStateNormal];//sender用于獲得了不同的button的文字 titleForState是根據button狀態獲取文字的函數 NSString *newText = [[NSString alloc] initWithFormat:@"%@ button pressed.", title];//將title中的文字放入newText中 statusText.text = newText; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)viewDidUnload { [super viewDidUnload]; self.statusText = nil; // Release any retained subviews of the main view. } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } else { return YES; } } - (void)dealloc { [statusText release]; [super dealloc]; } @end ~~~ 接著我們把這些代碼與IB連接起來: 選擇MainStoryboard_iphone.storyboard 右擊View Controller Scene中的 Buton,選擇Touch down與界面的 bottonPressed相連接: ![](https://box.kancloud.cn/2016-03-09_56dfc82820845.png) 接著將lable和statusText連接在一塊: ![](https://box.kancloud.cn/2016-03-09_56dfc82839c63.png) 最后運行程序,點擊botton看看效果: ![](https://box.kancloud.cn/2016-03-09_56dfc8284e99a.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看