前段時間工作寫了一個懸浮框,需要寫一下點擊事件,然后發現在uiwindow上的時候并不是那么好實現,然后網上查詢也沒有得到自己想要的答案,最后自己還是解決了問題,特此分享給大家。
WYTabBarController*tabbar = (WYTabBarController*)[UIApplicationsharedApplication].keyWindow.rootViewController;
//WYTabBarController是自己的主控制器
SuOneViewController*sec = [[SuOneViewControlleralloc]init];
[tabbar.viewControllers[0]pushViewController:secanimated:YES];
上面就是實現功能的全部代碼,有什么問題可以咨詢我喲。