0
我想在应用程序进入后台或重新输入前景时重置我的UISearch。当UISearch的tableview被隐藏时就足够了。如何从Appdelegate方法应用程序重置UISearchWillEnterForeground
但是,当我试图从AppDelegate.m隐藏它不起作用。我也记录了UIElements,也有(null)。
这里是我尝试访问它:
- (void)applicationWillEnterForeground:(UIApplication *)application
{
XLog(@"");
/*
Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
*/
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
XLog(@"");
searchViewController = [[SearchViewController alloc] initWithNibName:@"SearchViewController_iPad" bundle:[NSBundle mainBundle]];
} else {
XLog(@"");
searchViewController = [[SearchViewController alloc] initWithNibName:@"SearchViewController_iPhone" bundle:[NSBundle mainBundle]];
}
XLog(@"searchViewController.searchBar.text: %@", searchViewController.searchBar.text);
searchViewController.tableViewSearch.hidden = YES; // is (null)
XLog(@"searchViewController.tableViewSearch: %@", searchViewController.tableViewSearch); // is (null)
}
如何访问呢?在这里我有什么不对吗,还是不允许通过appdelegate.m访问其他类的元素?