gpt4 book ai didi

iOS 7 : Custom Back Indicator Image Position

转载 作者:IT王子 更新时间:2023-10-29 08:19:22 25 4
gpt4 key购买 nike

我在正确设置自定义后退指示器图像时遇到问题。指示器不居中!

这是一张图片:

Screenshot showing non-centered custom back indicator image

我在 didFinishLaunchingWithOptions: 方法中设置指示器图像...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

UIImage *image = [UIImage imageNamed:@"Back"];
[UINavigationBar appearance].backIndicatorImage = image;
[UINavigationBar appearance].backIndicatorTransitionMaskImage = image;

return YES;
}

我怎样才能居中呢?

p.s 我已经读过这个 Custom back indicator image in iOS 7 not vertically centered ,但实际上它对我不起作用。

最佳答案

 UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, 2, 0);
UIImage *backArrowImage = [[UIImage imageNamed:@"Back"] imageWithAlignmentRectInsets:insets];

[[UINavigationBar appearance] setBackIndicatorImage:backArrowImage];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:backArrowImage];

关于iOS 7 : Custom Back Indicator Image Position,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25250389/

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