繁体   English   中英

尝试将tabBarController设置为半透明。 但是没有用。 可以设置Alpha

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

我正在使用标准代码来设置TabBarController,但我一生都无法做到半透明。 我用TabBarController覆盖了一个视图,我希望该图像通过TBC显示。 实际上,我希望条像数位应用程序一样在几秒钟后消失,但现在一次只能一次。 半透明第一。 谢谢

- (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]; 
}

要使标签栏透明,请将tabBar.Opaque设置为No。然后,您可以调整tabBar.alpha值以调整透明度。 可以对此更改进行动画处理。

从UIView的文档中:“ @property(nonatomic)CGFloat alpha讨论可以对此属性进行更改。可以使用beginAnimations:context:类方法开始,使用commitAnimations类方法结束动画块。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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