[英]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. 我正在使用标准代码来设置TabBarController,但我一生都无法做到半透明。 I overlay a view with my TabBarController, I would like that image to show through the TBC.
我用TabBarController覆盖了一个视图,我希望该图像通过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. 要使标签栏透明,请将tabBar.Opaque设置为No。然后,您可以调整tabBar.alpha值以调整透明度。 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. " 从UIView的文档中:“ @property(nonatomic)CGFloat alpha讨论可以对此属性进行更改。可以使用beginAnimations:context:类方法开始,使用commitAnimations类方法结束动画块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.