2011-11-08 18 views
0

スライドショーで作っています。ナビゲーションバーを写真アプリと同じように見せたいこの透明性をどうやって得るのですか?UINavigationBarを半透明にします

私が試してみました:

- (void)drawRect:(CGRect)rect { 
    [[UIColor clearColor] set]; 
    CGContextFillRect(UIGraphicsGetCurrentContext(), rect); 

} 

UIImage *bg = [UIImage imageNamed:@"navbar.png"]; 
UIImageView *background = [[UIImageView alloc] initWithImage:bg]; 
background.frame = self.navigationController.toolbar.bounds; 
background.autoresizingMask = UIViewAutoresizingFlexibleWidth; 
BOOL isIOS5 = [[[UIDevice currentDevice] systemVersion] intValue] >= 5; 
self.navigationController.toolbar.backgroundColor = [UIColor clearColor]; 
[self.navigationController.toolbar insertSubview:background atIndex: (isIOS5 ? 1 : 0)]; 

答えて

2

は、私はあなたがUINavigationBartranslucentプロパティを探していると信じています。試してください:

[[self.navigationController navigationBar] setTranslucent:YES]; 
関連する問題