我正在制作幻灯片。我希望导航栏看起来与照片应用程序中的相同。我如何获得这种透明度?
我试过了:
- (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)];
答案 0 :(得分:2)
我相信您正在寻找translucent
的{{1}}属性。尝试:
UINavigationBar