RAMAnimatedTabBarController隱藏問題

之前設(shè)計那邊需要一個tabbar中心突出的效果用的這個庫還不錯推薦下還帶幾種動畫動畫處理的還很細膩2700個星的庫還是很不錯的RAMAnimatedTabBarController地址地址請戳

之后遇到了一個問題就是隱藏tabbar圖標(biāo)不隱藏看了下圖發(fā)現(xiàn)作者吧tabbar弄到了windows上,而且看了issus貌似大家都遇到這個問題作者也沒回復(fù),自己弄吧。蛋疼了,又不想換庫折騰了幾天自己寫了個類。

importUIKit

extensionRAMAnimatedTabBarController:UINavigationControllerDelegate{

funchideTabBar(flag:Bool) {

letatc =self

leticons= atc.iconsView

if(flag ==true){

foriconinicons {

icon.icon.superview?.hidden=true

}

atc.tabBar.hidden=true

}else{

atc.tabBar.hidden=false

foriconinicons {

ifletsup = icon.icon.superview{

sup.hidden=false

sup.superview?.bringSubviewToFront(sup)

}

}

}

}

判斷下進來是push還是其余的我們這邊所有的子界面是隱藏的我直接做的是push進來進行隱藏

funcnavigationController(navigationController:UINavigationController, willShowViewController viewController:UIViewController, animated:Bool) {

hideTabBar(viewController.hidesBottomBarWhenPushed)

}

funcnavigationController(navigationController:UINavigationController, didShowViewController viewController:UIViewController, animated:Bool){

hideTabBar(viewController.hidesBottomBarWhenPushed)

}

}

然后再RAMAnimatedTabBarController.swift里面調(diào)用58行左右的didload里面添加

super.viewDidLoad()

letconls = (self.viewControllersas? [UIViewController])?.filter({$0isUINavigationController}) ?? []

forctlinconls{

(ctlas!UINavigationController).delegate=self

}

可以解決已經(jīng)提issus但是最近發(fā)現(xiàn)連續(xù)多級push在返回來tabbar會蓋住tabbar的image,我懷疑是tababr每次進界面時候應(yīng)該會走topviewcontroller之類的方法,但是在tabbar的.h里面也沒找到這個方法,解決這個問題在隱藏界面直接執(zhí)行這兩個方法讓脫離本界面時候進行顯示。這個必須手寫勾選store時候會造成出界面時候tabbar再次覆蓋image

-(void)viewWillAppear:(BOOL)animated

{

self.hidesBottomBarWhenPushed=YES;

}

-(void)viewWillDisappear:(BOOL)animated

{

self.hidesBottomBarWhenPushed=NO;

}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容