問題は写真では分かりやすいです。 私はUINavigationControllerを使用して、ユーザー間でビューを切り替えることができます。pushViewControllerのときにナビゲーションバーが正しく表示されない
最初のビューはそうのような検索バーとテーブルビューが含まれています
二つ目は、私は検索バー、ナビゲーションをクリックすると、セルの情報が表示
ている基本的な図であり、コントローラが非表示になり、検索バーが上部に表示されます。今
、私はセルをクリックした場合、それは第二のビューになりますが、ナビゲーションバーが最初に以下のように隠されている:
そして、それは自動的にそのように表示されます:
がどのように誰もが知っています..私は次のビューコントローラをプッシュする前に、ナビゲーションバーを表示するようなものをいくつか試してみましたが、それは非常に醜いです連絡先アプリケーションのように、2番目のビューに直接ナビゲーションバーを表示しますか?
[UPDATE]:コード
AppDelegate.mあなたが必要な場合は
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
FirstViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
SecondViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
viewController1.managedObjectContext = [self managedObjectContext];
viewController2.managedObjectContext = [self managedObjectContext];
viewController1.viewController2 = viewController2;
UINavigationController *navigationcontroller1 = [[UINavigationController alloc] initWithRootViewController:viewController1];
[navigationcontroller1.navigationBar setTintColor:[UIColor lightGrayColor]];
UINavigationController *navigationcontroller2 = [[UINavigationController alloc] initWithRootViewController:viewController2];
[navigationcontroller2.navigationBar setTintColor:[UIColor lightGrayColor]];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navigationcontroller1, navigationcontroller2, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
FirstView.m
- (void) searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar {
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (!noResultsToDisplay) {
PinDetailsViewController *pinDetailsViewController = [[PinDetailsViewController alloc] initWithNibName:@"PinDetailsViewController" bundle:nil];
NSManagedObject *managedObject = [fetchedResultsController objectAtIndexPath:indexPath];
Pin *pin = (Pin *) managedObject;
[self.navigationItem setTitle:@"Pins"];
[self.navigationController pushViewController:pinDetailsViewController animated:YES];
[pinDetailsViewController updateWithPin:pin];
}
}
(私はnavigationcontroller2について話しています)他のものは、ただ尋ねるが、私はそれがすべてそこにあると思う。
いくつかのコードを投稿してください。それ以外の場合は、問題がどこにあるかを確認することは非常に困難です。 – MishieMoo