我是Ios開發的新手,我遵循Big nerd書來學習它。我對「navigationController」有困惑。 例如在我的類,它是UITableViewController
一個實例(同爲UIViewController
任何子類也一樣)我有這樣的:navigationController屬性在UINavigationController.h中聲明,但是UIViewController的一個屬性
[[self navigationController]
pushViewController:detailViewController
animated:YES];
,當我看着蘋果文檔此navigationController
似乎是UIViewController
的屬性,但據說它是在UINavigationController.h
中宣佈的! 我打開UIviewcontroler.h
,沒有屬性或方法navigationController
,但由於文件說,這的確是在UINavigationController.h
它沒有任何意義可言。首先我知道子類繼承父類的屬性和方法,但UITableViewControler
並不意味着UINavigationController
的子類,而是UiViewController的子類。所以希望有人明白我在問什麼。當我不從UINavigationController
繼承時,我如何能夠訪問此屬性?以及文檔如何顯示作爲UiViewController
的財產?
謝謝。你看起來很有知識。我來自Java背景,這就是爲什麼這對我來說不是通常的事情。 –