gpt4 book ai didi

ios - 导航按钮文字阴影不出现 iOS 7

转载 作者:可可西里 更新时间:2023-11-01 05:41:23 24 4
gpt4 key购买 nike

到目前为止,我已经更新了我们应用程序的导航栏后退按钮项目,使其在 iOS 7 中看起来与在 iOS 6 中一样,但我无法在 iOS 7 中显示文本阴影。

iOS 7: enter image description here

iOS 6: enter image description here

(为了测试,偏移量变大了)

代码:

    UIButton *backButton = [[UIButton alloc] initWithFrame: CGRectMake(0, 0, 80.0f + width_offset, 30.0f)];
UIImage *buttonImage = [[UIImage imageNamed:@"navigation_back_btn"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 15, 5, 5)];
[backButton setBackgroundImage:buttonImage forState:UIControlStateNormal];
[backButton setTitle:title forState:UIControlStateNormal];
[backButton.titleLabel setFont:[UIFont defaultFontWithType:kFontBold andSize:12]];
[backButton.titleLabel setTextColor:[UIColor whiteColor]];
[backButton.titleLabel setShadowColor = [UIColor blackColor]];
[backButton.titleLabel setShadowOffset:CGSizeMake(5.0f, 5.0f)];
[backButton addTarget:viewController action:@selector(popBack) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
viewController.navigationItem.leftBarButtonItem = backButtonItem;

我还想将按钮移到左侧,但这不太重要。

最佳答案

尝试在 UIButton 本身上设置标题阴影颜色:

[backButton setTitleShadowColor:[UIColor blackColor] forState:UIControlStateNormal];

关于ios - 导航按钮文字阴影不出现 iOS 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19104969/

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