Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // AppDelegate.h
- #import <UIKit/UIKit.h>
- #import "TopViewController.h"
- // UINavigationControllerのインスタンス追加
- @interface AppDelegate : UIResponder <UIApplicationDelegate> {
- UINavigationController *naviController;
- TopViewController *topController;
- }
- @property (strong, nonatomic) UIWindow *window;
- @end
- // AppDelegate.m
- #import "SampleAppDelegate.h"
- @implementation SampleAppDelegate
- @synthesize window;
- - (void)applicationDidFinishLaunching:(UIApplication *)application
- {
- self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
- topController = [[TopViewController alloc] init];
- naviController = [[UINavigationController alloc] initWithRootViewController:topController];
- [self.window addSubview:naviController.view];
- [self.window makeKeyAndVisible];
- }
- @end
- // 遷移前 TopViewController.h
- #import <UIKit/UIKit.h>
- #import "NextViewController.h"
- // 遷移後のインスタンス追加
- @interface ViewController : UIViewController {
- SecondViewController *secondController;
- }
- @end
- // 遷移前 TopViewController.m
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // UINavigationBar hidden = YES
- self.navigationController.navigationBar.hidden = YES;
- }
- - (void)tapAction
- {
- // 適当な場所に画面遷移をおく
- secondController = [[NextViewController alloc] init];
- [self.navigationController pushViewController:secondController animated:YES];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement