I have subclassed UITabBar and overriden drawRect: method to make it transparent (and make it look like I need to). Problem I am having is that the view added to UITabBarController does not cover whole screen but ends 49 pixels above bottom, so even tho I have transparent tabbar, I can't see thing behind it.
Is there proper way how I can set size of UIView inside UITabBarController to cover entire screen?
P.S.:I know it is not good idea to show content behind tabbar. I do not want to show any content there, just art, that is specific to each View and needs to be visible through tabbar.
If you want to have content behind the UITabBar
, I see two options:
Don't use
UITabBarController
– This will definitely work, because you can position the views as you want and it is not so difficult to implement it.Try turning off
clipsToBounds
on the view and place some view out of his bounds.// UIViewController contained in UITabBarController: self.view.clipsToBounds = NO; UIView *viewBehindTabBar = [[UIView alloc] init]; viewBehindTabBar.frame = CGRectMake(0, self.view.bounds.size.height, self.view.bounds.size.width, 49); // autoresizing mask, background color, ... [self.view addSubview:viewBehindTabBar];
You can simply create a category of UITabBar or UITabBarController
and set It's Alpha
.
Something Like :-
@implementation UITabBarController (Translucent)
- (void)createImage
{
[self.tabBar setAlpha:0.1];
}
@end
You can set Alpha even in Drawrect .
来源:https://stackoverflow.com/questions/15431795/how-to-create-translucent-with-content-behind-it-uitabbar