私のアプリでは、viewController から splitViewController を呼び出しました (以下のコードを参照)。ここで、会社のラベルなどを表示するために、splitViewController の上部に共通のビューが必要です。上部に共通ビューを追加する方法は?
Appdelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.window.rootViewController = self.navigationController;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
ViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
-(IBAction)btnClick:(id)sender
{
PopMenuViewController *menuVC = [[PopMenuViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *menuNavController = [[UINavigationController alloc] initWithRootViewController:menuVC];
PopMenuDetailViewController *detailVC = [[PopMenuDetailViewController alloc] initWithNibName:@"PopMenuDetailViewController" bundle:nil];
UINavigationController *detailNavController = [[UINavigationController alloc] initWithRootViewController:detailVC];
menuVC.detailViewController = detailVC;
splitViewController = [[UISplitViewController alloc] init];
splitViewController.viewControllers = @[menuNavController, detailNavController];
self.view.window.rootViewController = splitViewController;
}