![](/img/trans.png)
[英]If I add a UISwitch control to each of my table view cells, how can I tell which cell it belongs to?
[英]How Can I Use Buttons to Control Navigation in Root View, Instead of Table Cells?
我正在開發我的第一個iPhone應用程序,它是一個基於導航的應用程序。 我想知道如何在根視圖中使用像這個應用程序的圖標/按鈕來控制導航而不是默認的表格單元格視圖。
我會欣賞一些一步一步的指南,因為我是一個新手,並沒有得到如何做到這一點,閱讀文檔或類似的問題。
不是從基於導航的應用程序開始,而是從基於窗口的應用程序開始,並在app delegate中創建UINavigationController的實例(在方法appDidFinishLaunching中),並將任何UIviewController設置為它的根視圖控制器。 然后,您可以在該視圖控制器中執行任何自定義
最后將navigationController設置為應用程序窗口的rootviewController。
UIViewController *myCustomRootViewController = [[UIViewController alloc] init];
UINavigationController *myNavController = [[UINavigationController alloc] initWithRootViewController:myCustomRootViewController];
[myCustomRootViewController release];
self.window.rootViewController = myNavController;
[myNavController release];
在提出問題之前,您確實需要使用谷歌或Stack Overflow上的任何其他地方。 我在一分鍾內發現了這一點 。 如果你要添加一個導航控制器(這是處理表視圖中的視圖),那么使用– pushViewController:animated:
而不是presentModalViewController:animated:
並且在推送或呈現視圖控制器之后,不要忘記發布如果您不使用自動參考計數,則使用它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.