Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. // AppDelegate.h
  2. #import <UIKit/UIKit.h>
  3. #import "TopViewController.h"
  4.  
  5. // UINavigationControllerのインスタンス追加
  6. @interface AppDelegate : UIResponder <UIApplicationDelegate> {
  7. UINavigationController *naviController;
  8. TopViewController *topController;
  9. }
  10.  
  11. @property (strong, nonatomic) UIWindow *window;
  12.  
  13. @end
  14.  
  15. // AppDelegate.m
  16. #import "SampleAppDelegate.h"
  17.  
  18. @implementation SampleAppDelegate
  19.  
  20. @synthesize window;
  21.  
  22. - (void)applicationDidFinishLaunching:(UIApplication *)application
  23. {
  24. self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
  25.  
  26. topController = [[TopViewController alloc] init];
  27. naviController = [[UINavigationController alloc] initWithRootViewController:topController];
  28.  
  29. [self.window addSubview:naviController.view];
  30.  
  31. [self.window makeKeyAndVisible];
  32. }
  33.  
  34. @end
  35.  
  36. // 遷移前 TopViewController.h
  37. #import <UIKit/UIKit.h>
  38.  
  39. #import "NextViewController.h"
  40.  
  41. // 遷移後のインスタンス追加
  42. @interface ViewController : UIViewController {
  43. SecondViewController *secondController;
  44. }
  45.  
  46. @end
  47.  
  48. // 遷移前 TopViewController.m
  49. - (void)viewDidLoad
  50. {
  51. [super viewDidLoad];
  52.  
  53. // UINavigationBar hidden = YES
  54. self.navigationController.navigationBar.hidden = YES;
  55.  
  56. }
  57.  
  58. - (void)tapAction
  59. {
  60. // 適当な場所に画面遷移をおく
  61. secondController = [[NextViewController alloc] init];
  62. [self.navigationController pushViewController:secondController animated:YES];
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement