gpt4 book ai didi

ios - 移除 UIBarButtonItem 的文本阴影

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:58:51 24 4
gpt4 key购买 nike

我已经使用

调整了 UIBarButtonItem 以具有自定义字体和颜色属性
self.followButton = [[[UIBarButtonItem alloc]

initWithTitle: NSLocalizedString(@"TWITTER_FOLLOW_BUTTON_TEXT", nil)
style:UIBarButtonItemStylePlain
target:self
action:@selector(handleFollowButtonPressed:)]
autorelease];

,

[self.followButton setBackgroundImage:[UIImage new] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];  

,

[followButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"Helvetica" size:14.0], UITextAttributeFont,nil] forState:UIControlStateNormal];  

NSDictionary *attributes = @{UITextAttributeTextColor : [UIColor colorWithRed:1 green:0.176 blue:0.333 alpha:1 /*#ff2d55*/ ]};

[followButton setTitleTextAttributes:attributes
forState:UIControlStateNormal];

获得外观

enter image description here

如何删除按钮项的文本阴影而不用更改图像?

最佳答案

UIBarButtonItemUITextAttributeTextShadowOffset 属性设置为 UIOffsetMake(0.0, 0.0)

您需要将 UIOffset 存储在 NSValue 对象中:[NSValue valueWithUIOffset: UIOffsetMake(0.0, 0.0)]

关于ios - 移除 UIBarButtonItem 的文本阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17266396/

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