简体   繁体   中英

Trying to set tabBarController translucent. But not working. Alpha can be set

I'm using the standard code for setting up my TabBarController, but I can't for the life of me get it to be translucent. I overlay a view with my TabBarController, I would like that image to show through the TBC. Actually I want the bar to just fade away like the Photo app does after a few seconds, but for now, one step at a time. Translucent first. thanks

- (void)applicationDidFinishLaunching:(UIApplication *)application 
{ 

 tabBarController = [[UITabBarController alloc] init]; 

 //tabBarController.tabBar.barStyle = UIBarStyleBlackTranslucent;

 //ERROR: request for member in something not a structure of member

 //BUT this will work! But just affects the alpha value

 tabBarController.tabBar.alpha = .5;

 view1Controller = [[View1Controller alloc] init];  
 view2Controller = [[View2Controller alloc] init]; 
 view3Controller = [[View3Controller alloc] init]; 

 tabBarController.viewControllers = [NSArray arrayWithObjects:view1Controller, view2Controller, view3Controller, nil];  

 [window addSubview:tabBarController.view]; 
 [window makeKeyAndVisible]; 
}

To make a Tab Bar transparent, set tabBar.Opaque to No. You can then adjust the tabBar.alpha value to adjust the level of transparency. It is possible to animate this change.

From the docs for UIView: "@property(nonatomic) CGFloat alpha Discussion Changes to this property can be animated. Use the beginAnimations:context: class method to begin and the commitAnimations class method to end an animation block. "

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM