本文介绍了告诉UITabBar加载哪个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
触摸UITabBar按钮时,是否可以根据某些状态加载视图?例如,我触摸View1的主页"按钮.比我做一些代码,当我再次触摸主页"按钮时,将加载View2.
Is there a way to load views according to some states when touchingon UITabBar button?For example I touch "Home" button View1 loads. Than i do some code and when i touch "Home" button again View2 loads.
推荐答案
可以完成...假设我们在内存中有两个视图 myView1 & myView2 ..
It can be done ...Suppose we have two view in memory myView1 & myView2..
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
if(OnPressHomeTabBarButton) // Put your condition at this place
{
[myView1 removeFromSuperview];
[self.view addSubview:myView2];
}
else
{
[myView2 removeFromSuperview];
[self.view addSubview:myView1];
}
}
这篇关于告诉UITabBar加载哪个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!