簡體   English   中英

我如何在tabBar Button按下時有一個調用函數,但僅當視圖當前處於按下狀態時才可以?

[英]How can I have a function called on tabBar Button press but only if the view is currently the one being pressed?

我正在嘗試實現類似於facebook和reddit應用程序的功能,以便當我在查看新聞提要時按下新聞提要按鈕時,它滾動到頂部。 但是,當我從另一個選項卡按下新聞源按鈕時,它僅加載視圖控制器的緩存狀態。 我想具有類似的功能,其中按下與當前視圖活動關聯的選項卡欄項會調用一個函數。

你有嘗試過嗎? 使用標簽欄項設置操作-iphone,然后將重新加載的代碼放入didSelectItem方法中。

因此,在進行了一些測試之后,我發現對UITabBarControllerDelegate occurs in between的委托調用UITabBarControllerDelegate occurs in between viewWillAppear and viewDidAppear UITabBarControllerDelegate occurs in between and so I simply set a boolean value to false in viewWillAppear so I simply set a boolean value to false in and change it in viewDidAppear中and change it in

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM