gpt4 book ai didi

ios - 切换标签时 UITabBarController 变黑

转载 作者:行者123 更新时间:2023-12-01 20:19:28 28 4
gpt4 key购买 nike

我嵌入了一个 UITabBarController 在 UINavigationController 中。 UITabBarController 包含 3 个不同的选项卡,导致 3 个不同的 UIViewControllers 显示 UITableView。我通过 Storyboard 实现了所有这些。在第一个 UIViewController 中,我实现了 UISearchController 以编程方式运行的 UITableView。 当我搜索特定单元格然后切换选项卡时, View 变为黑色。
我相信这个问题与 SearchController 有一些关系,因为在包含 SearchController 之前,我没有任何问题。

我在这里解决了其他几个问题,但没有一个可以解决我的问题。

编辑:

下面是我与 SearchController 相关的代码。

@接口(interface)

@property (nonatomic, strong) UISearchController *searchController;
@property BOOL searchControllerWasActive;
@property BOOL searchControllerSearchFieldWasFirstResponder;

@实现

viewDidAppear()
self.searchController = [[UISearchController alloc]initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
[self.searchController.searchBar sizeToFit];
self.tblContactsTable.tableHeaderView = self.searchController.searchBar;

self.searchController.delegate = self;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.searchBar.delegate = self;

self.definesPresentationContext = YES;

- (void)updateSearchResultsForSearchController:(UISearchController *)searchController
//reloads table view according to what is searched.

-(void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
self.searchController.searchBar.showsCancelButton = NO;

最佳答案

UITabBarController 应该是 Storyboard/代码中窗口上最顶层的元素,您可以将导航 Controller 和 View Controller 添加到 UITabBarController View Controller 。
https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITabBarController_Class/index.html

关于ios - 切换标签时 UITabBarController 变黑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35980266/

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