2017-06-13 28 views
0

我正在學習如何在iOS中使用目標c來使用SQLite。我提到this tutorial,並在題爲「爲代表應用程序的文件覆蓋整個院落 - SqliteDataAppDelegate.h 」一節筆者編碼如下:如何將控制器添加到頭文件

作者的代碼

#import <UIKit/UIKit.h> 
#import "DisplayViewController.h" 

@interface SqliteDataAppDelegate : UIResponder <UIApplicationDelegate> 

@property (strong, nonatomic) UIWindow *window; 
@property (strong, nonatomic) UINavigationController 
*navigationController; 
@property (strong, nonatomic) DisplayViewController 
*displayViewController; 

@end 

其實,在中故事板,我添加了一個視圖控制器和我嵌入NavigationController如圖圖像-1以下

圖像-1

enter image description here

但我試着Ctrl +拖動NavigationController和ViewController到SqliteDataAppDelegate.h文件,但它是不可能的。

請讓我知道如何將ViewController和UINavigationController添加到SqliteDataAppDelegate.h文件和什麼是UIWindow?

+0

使用具有'XIB'的'UIView'比你可以在當前窗口中添加programetically視圖,'[self.window addSubView:viewWithXIB];' – Dhiru

+0

請問如何在Xcode中找到XIB – user2121

+0

@ user2121教程你正在使用的是一款非常適合老版iOS和Xcode的老版本。我更喜歡這個教程,而不是那個http://www.appcoda.com/sqlite-database-ios-app-tutorial/ – 2017-06-13 10:44:55

回答

0

這是不可能的。您無法連接ViewController的子視圖作爲插座。看看示例代碼,在屬性之前沒有IBOutlet,所以我假設它們是由代碼創建的。

相關問題