objective-c – 如何在Interface Builder中使用Storyboard連線Page View Controller的資料來源插座
,我們應該可以將一個Page View Controller新增到故事板中,然後通過連線插座可選地設定資料來源.
Creating a Page View Controller Interface Using a Storyboard
The Page-Based Application Xcode template creates a new project with a page view controller as the initial scene.
To add a page view controller to an existing storyboard, do the following:
- Drag a page view controller out of the library. Add a page view controller scene to your storyboard.
- In the Attributes inspector, set up the appropriate options.
- Optionally, set a delegate, a data source, or both by connecting the corresponding outlets.
- Display it as the first view controller by selecting the option Is Initial View Controller in the Attributes inspector (or present the view controller in your user interface in another way.)
那麼我就這樣定義了一個UIPageViewController子類
@interface DetailsPageViewController : UIPageViewController <UIPageViewControllerDataSource>
但是當我嘗試連線資料來源插座時,它不會突出顯示控制器或允許連線它.我也嘗試在其他控制器上實現UIPageViewControllerDataSource,但是我也遇到不能連線插座的問題.
誰能幫忙?
請注意,Apple文件說明UIPageViewController通常不是子類.您的UIPageViewControllerDataSource不需要是View Controller的子類.您可以使其成為NSObject的子類.
通常只有在故事板上出現的東西,即UI元素,才會顯示在故事板左側的文件輪廓中(只要它沒有被隱藏).如果您的委託/資料來源尚未存在,則可以在適當的場景中將“物件”(黃色立方體)拖放到文件大綱中.
然後單擊剛剛新增的物件,並使用“身份檢查器”窗格將其具體的類更改為資料來源類.然後可以通過從“連線”檢查器拖動一行到其上,以正常方式用作連線的目標.
http://stackoverflow.com/questions/13171360/how-to-connect-datasource-outlet-of-a-page-view-controller-using-storyboard-in-i