gpt4 book ai didi

iphone - 使 UINavigationBar 半透明

转载 作者:行者123 更新时间:2023-11-28 23:11:43 26 4
gpt4 key购买 nike

我正在制作幻灯片。我希望导航栏看起来与照片应用程序中的一样。我如何获得这种透明度?

我试过:

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

最佳答案

我相信您正在寻找 UINavigationBartranslucent 属性。尝试:

[[self.navigationController navigationBar] setTranslucent:YES];

关于iphone - 使 UINavigationBar 半透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8052701/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com