带背景色的CustomUITabar
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了带背景色的CustomUITabar相关的知识,希望对你有一定的参考价值。
//header #import <Foundation/Foundation.h> @interface CustomUITabBarController : UITabBarController { } @end //implementation #import "CustomUITabBarController.h" @interface UITabBarController (private) - (UITabBar *)tabBar; @end @implementation CustomUITabBarController -(float)rgbPercent:(int)rgb { int tmp = (rgb * 100) / 255; } - (void)viewDidLoad { [super viewDidLoad]; CGRect frame = CGRectMake(0.0, 0.0, self.view.bounds.size.width, 48); UIView *v = [[UIView alloc] initWithFrame:frame]; //UIColor *col = [UIColor colorWithRed:[self rgbPercent:0] green:[self rgbPercent:128] blue:1 alpha:1]; UIColor *col = [UIColor colorWithRed:[self rgbPercent:128] green:1 blue:0 alpha:1]; [v setBackgroundColor:col]; [v setAlpha:0.5]; [[self tabBar] addSubview:v]; [v release]; } @end ////////////////////////// sample of use ////////////////////////// CustomUITabBarController *tabBar = [[CustomUITabBarController alloc] init]; [window addSubview:tabBar.view];
以上是关于带背景色的CustomUITabar的主要内容,如果未能解决你的问题,请参考以下文章
UISearchbar去除背景色的方法,适合iOS5/6/7/8.0beta