Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iPad和iPhone中导航按钮、分段按钮的50%透明背景_Iphone_Ipad_Ios_Transparent_Customization - Fatal编程技术网

iPad和iPhone中导航按钮、分段按钮的50%透明背景

iPad和iPhone中导航按钮、分段按钮的50%透明背景,iphone,ipad,ios,transparent,customization,Iphone,Ipad,Ios,Transparent,Customization,有没有办法自定义导航按钮,像iBooks一样分割按钮背景 查看iBooks书架左上角。按钮背景大约50%透明。 多漂亮的一张照片啊 有人知道如何使用它吗 所有人都认为它在我看来就像是一个带有alpha值(比如0.5)的ui按钮,在带有自定义背景的ui导航条的顶部 尝试将类似的内容放入您的appDelegate.m @implementation UINavigationBar (UINavigationBarCategory) - (void)drawRect:(CGRect)rect { UI

有没有办法自定义导航按钮,像iBooks一样分割按钮背景

查看iBooks书架左上角。按钮背景大约50%透明。 多漂亮的一张照片啊

有人知道如何使用它吗


所有人都认为它在我看来就像是一个带有alpha值(比如0.5)的
ui按钮,在带有自定义背景的
ui导航条的顶部

尝试将类似的内容放入您的
appDelegate.m

@implementation UINavigationBar (UINavigationBarCategory)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"navigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
或者你可以在这里输入一种方法

当您将按钮添加到导航栏时

button.alpha = 0.5;

希望这有帮助

我建议使用50%透明度的图像,而不是设置button.alpha。在后一种情况下,标签或前景图像也会受到alpha的影响。感谢您的宝贵意见。我认为button.alpha会影响按钮的文本透明度,这不是我想要的。让我试试透明背景图像。再一次谢谢邦吉和奥特温。