加载应用程序时如何取消选择选项卡 [英] How to Deselect tab when application is loaded
问题描述
我正在处理标签栏应用程序.启动应用程序时,默认情况下会选择第一个选项卡.
I am working on tabbar application. When application started, by default first tab is selected.
我想要的是启动应用程序时,应该显示选项卡栏而不选择任何选项卡.就像说,如果我有4个选项卡,则当应用程序启动时它们不会被选中.默认情况下,第一个被选中.
What I want to is when I start application, tab bar should be displayed without selected tab. Like say, if i have 4 tabs then non them get selected when application get launched. By default first one get selected.
我想显示一些不属于任何选项卡的视图.
I want to display some views which are not part of any of tabs.
有可能做吗?
谢谢...
推荐答案
是的,这是可能的.
您需要以编程方式创建视图,并在 Window中将该视图添加为SuperView ,当您不需要时,只需将其从SuperView中删除强>.
You need to create a view programmatically and add that view in Window as SuperView , when you don't need it just remove it form SuperView.
[SuperViewname removeFromSuperView];
代码段:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the tab bar controller's view to the window and display.
[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
**AdditionalView**
//======================= LoginView ================================================
loginview=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
imgview_logingpage=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
imgview_logingpage.image=[UIImage imageNamed:@"Screen.jpg"];
loginview.backgroundColor=[UIColor blackColor];
[self.window addSubview:Viewnavigation.view];
[self.window addSubview:loginview]; // To add the View in Window View
}
//从SuperView中删除视图-(无效)login_clicked:(id)发件人{
// To REmove the View from SuperView -(void)login_clicked:(id)sender {
Homepage *obj_homepage=[[Homepage alloc]initWithNibName:@"Homepage" bundle:nil];
[self.window addSubview:obj_homepage.view];
[loginview removeFromSuperview];
[loginview release];
}
或者更简单的方法是:通过PresentModalViewController 打开新视图
Or either the more easy way is : Open a new view via PresentModalViewController
这篇关于加载应用程序时如何取消选择选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!