gpt4 book ai didi

ios - 无法访问导航 Controller 后退按钮

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

在我的应用程序的详细 View 中,导航 Controller 的后退按钮似乎从一些不敬虔的表现中获得了颜色提示。通过一条通往详细 View 的路径,它是蓝色的;通过另一个,它是黑色的。在任何一种情况下,后退按钮似乎都不存在于 self.navigationController 对象中。

所以这是一个详细 View :

detail view of my app

这是此时导航 Controller 的快照:

enter image description here

我很确定我知道如何更改这个特定元素的颜色,但我不知道在哪里可以找到它。想法?

VenueTableViewController.m

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *show;

if( [self.listType isEqualToString:@"showsByRegion"] )
{
NSString *venueIndex = [[self.allShows allKeys] objectAtIndex:[indexPath indexAtPosition:0]];
int index = [indexPath indexAtPosition:1];
show = [[self.allShows objectForKey:venueIndex] objectAtIndex:index];
} else {
int index = [indexPath indexAtPosition:(indexPath.length - 1)];
show = [self.showsAtVenue objectAtIndex:index];
}

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"
bundle:[NSBundle mainBundle]];

detailViewController = [storyboard instantiateViewControllerWithIdentifier:@"InfoViewController"];

detailViewController.showInfo = show;

// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];

}

InfoViewController.m

- (void)viewDidLoad
{
[super viewDidLoad];

self.tableView = [[self.view subviews] objectAtIndex:1];

[self createInfoViewDictionary];
[self addTopImage];
[self setFrameForTableView];
[self bindLabelsToProperties];

[self.navigationController.navigationBar setTitleTextAttributes:[SHColors sharedInstance].navBarText];
}

最佳答案

如果你得到不同的颜色是因为你从不同的 View Controller 到达那里并且这些 View Controller 有不同的 tintColor。

然后,您需要设置您想要使用的颜色:

- (void)viewDidLoad
{
....
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
....
}

如果你想为所有导航栏设置相同的颜色,你可以使用 UIAppearance 代理在 AppDelegate 中设置它们(编辑:如 Jordan Montel 所说)

关于ios - 无法访问导航 Controller 后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19384468/

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