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訪問其他類的元素?