我使用賽格瑞導航與類型show
segues.I的self.perfomSegueWithIndentifier
功能發現後,每導航等視圖/視圖 - 控制並沒有從RAM.What刪除我必須這樣做來解決這個移除View
移除View
回答
編程
比方說你有VC1
嵌入在UINavigationController
現在VC1
成爲導航堆棧的頂部視圖控制器。
所以,如果你打算VC1 -> VC2
self.navigationController?.pushViewController(vc2, animated: true)
在這種情況下VC2
成爲導航堆棧的頂部視圖控制器。
和,同時從VC2 -> VC1
回來(按鈕抽頭上VC2
執行此語句)
self.navigationController?.popViewControllerAnimated(true)
在那種情況下再次VC1
成爲導航堆棧上的頂視圖控制器。
使用Segue公司
只需使用Show(e.g Push)
並設置標識符,像我有pushView
並調用
self.performSegueWithIdentifier("pushView", sender: nil)
移動VC1 -> VC2
和回來VC2 -> VC1
使用相同的self.navigationController?.popViewControllerAnimated(true)
你不使用segues我是嗎?我不''UINavigationController'.I有簡單的viewControllers與segue導航 –
是的,但現在我也爲此添加了示例。 – Buntylm
如果我導航到vc2和vc3之後,在這種情況下它是否會從內存中刪除vc1? –
這是你在找什麼:
開按鈕輕按 - 視圖 - 控制器1:
self.navigationController.pushViewController(secondViewController, animated: true)
開按鈕輕按 - 視圖 - 控制器2:
self.navigationController?.popViewControllerAnimated(true)
好吧,我會試試這個 –
如果您正在採用segue方式,請正確實施'unwind'。看看這個[博客](http://spin.atomicobject.com/2014/10/25/ios-unwind-segues/)。 – Abhinav
請閱讀我的意見到另一個答案,你能解釋我如何在導航時從RAM中刪除視圖 –
- 1. 從View刪除子視圖?
- 2. 移動到其他View with RESideMenu
- 3. VIEW或MATERIALIZED VIEW?
- 4. Activity.addContentView(View)== ViewGroup.addContentView(View)?
- 5. 添加站點頁面時,自動從訪客角色中移除VIEW權限
- 6. android list view view addition
- 7. 除ng-view頁面加載以外
- 8. 簡單的ViewController/View,刪除白色條?
- 9. 移除*
- 10. 刪除或移除
- 11. 移除安裝Receiver或移除Firebase Analytics
- 12. AngularJS ng-view not showing view
- 13. achartengine switch view chart type in view
- 14. 如何移除「\'」?
- 15. 移除填充
- 16. 移除小數
- 17. 移除cardview
- 18. SFSB被移除
- 19. 移除由SimpleForm
- 20. 移除造型
- 21. onComplete DIV移除
- 22. 移除D3序
- 23. 移除填充
- 24. 移除/刪除laravel項目
- 25. 與刪除動態移除
- 26. One view controller with multiple views vs multiple view controller in a larger view controller
- 27. Android:Grid View
- 28. 從View
- 29. 與VIEW
- 30. CakePHP'Missing View'
你是否說你的視圖控制器對象保留,即使你解僱視圖控制器?如果是這樣,檢查是否有一些保留週期。 – Abhinav
我認爲他一次又一次地在導航棧中推送視圖控制器,這會消耗越來越多的內存。在執行segue之前,您可以在導航控制器上使用「popToRootViewController」。 – ryancrunchi
yes,exactly.Lets say我必須按鈕1 - 導航到第二個viewcontroller 2 - 導航到第一個視圖控制器,並且我想在導航後刪除先前的viewcontroller –