UIViewcontroller底部的UINavigationcontroller可以保存多个视图

时间:2022-06-01 18:30:59

In the appDelegate.m i have created navigationController initWithRootviewcontroller so that when my application launches UIViewController loads with navigationController and i want to display this navigationBar of the navigationController at the bottom of the UIViewController. But with this code it is showing at the top eventhough defined the frame.

在appDelegate.m中我创建了navigationController initWithRootviewcontroller,这样当我的应用程序启动时,UIViewController加载了navigationController,我想在UIViewController的底部显示navigationController的navigationBar。但是使用这个代码,它显示在顶部,尽管定义了框架。

   - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

UIViewController *myViewController = [[MainViewController alloc] init];

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:myViewController];

navigationController.navigationBar.tintColor = [UIColor blackColor];

[navigationController.navigationBar setFrame:CGRectMake(0, 435, 320,25)];

_window.rootViewController = navigationController;

[_window makeKeyAndVisible];

return YES;
}

Anyone knows how to show navigationcontroller at the bottom of the UIViewController.

任何人都知道如何在UIViewController的底部显示navigationcontroller。

Thanks for help.

感谢帮助。

1 个解决方案

#1


1  

From the UINavigationController and from the navigationBar property:

从UINavigationController和navigationBar属性:

navigationBar The navigation bar managed by the navigation controller. (read-only)

navigationBar导航控制器管理的导航栏。 (只读)

@property(nonatomic, readonly) UINavigationBar *navigationBar Discussion It is permissible to modify the barStyle or translucent properties of the navigation bar but you must never change its frame, bounds, or alpha values directly. To show or hide the navigation bar, you should always do so through the navigation controller by changing its navigationBarHidden property or calling the setNavigationBarHidden:animated: method.

@property(非原子,只读)UINavigationBar * navigationBar讨论允许修改导航栏的barStyle或半透明属性,但不能直接更改其框架,边界或alpha值。要显示或隐藏导航栏,您应始终通过导航控制器更改其navigationBarHidden属性或调用setNavigationBarHidden:animated:方法来执行此操作。

Source

#1


1  

From the UINavigationController and from the navigationBar property:

从UINavigationController和navigationBar属性:

navigationBar The navigation bar managed by the navigation controller. (read-only)

navigationBar导航控制器管理的导航栏。 (只读)

@property(nonatomic, readonly) UINavigationBar *navigationBar Discussion It is permissible to modify the barStyle or translucent properties of the navigation bar but you must never change its frame, bounds, or alpha values directly. To show or hide the navigation bar, you should always do so through the navigation controller by changing its navigationBarHidden property or calling the setNavigationBarHidden:animated: method.

@property(非原子,只读)UINavigationBar * navigationBar讨论允许修改导航栏的barStyle或半透明属性,但不能直接更改其框架,边界或alpha值。要显示或隐藏导航栏,您应始终通过导航控制器更改其navigationBarHidden属性或调用setNavigationBarHidden:animated:方法来执行此操作。

Source