Storyboards Tutorial (三)

來源:互聯網
上載者:User

標籤:des   cWeb   ar   io   os   sp   for   java   on   

這一節主要介紹segues,static table view cells 和 Add Player screen 以及 a game picker screen。

Introducing Segues

開啟 Main.storyboard拖拉一個Bar Button Item到Players視窗導覽列的右側。在Attributes inspector中改變Identifier為Add,就會出現一個+號button。

當使用者點擊時會彈出一個模態視窗來輸入新的player的詳細資料。

拖拉一個新的navigation controller然後ctrl+drag來把之前的加號和這個view controller來串連。選擇modal。

這個串連就是所知的segue(seg-way)表示的是從一個螢幕到另一個螢幕的傳送。通過食用segue你不需要再為view間的顯示來寫代碼了。

運行代碼,點擊加號,一個新的頁面就出現了。

新建立一個PlayerDetailsViewController並且把之前modal中的table view controller的class設定為PlayerDetailsViewController。雙擊navigation bar把名稱修改為Add Player.添加cacel和done bar item。

PlayerDetailsViewController.h中進行下面的修改:

 

#import <UIKit/UIKit.h>

@class PlayerDetailsViewController;

@protocol PlayerDetailsViewControllerDelegater <NSObject>

- (void)playerDetailsViewControllerDidCancel:(PlayerDetailsViewController *)controller;
- (void)playerDetailsviewControllerDidSave:(PlayerDetailsViewController *)controller;

@end

@interface PlayerDetailsViewController : UITableViewController
@property (nonatomic, weak) id <PlayerDetailsViewControllerDelegater>delegate;

- (IBAction)cancel:(id)sender;
- (IBAction)done:(id)sender;

@end

Storyboards Tutorial (三)

聯繫我們

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