Bläddra i källkod

improved example documentation

talkol 9 år sedan
förälder
incheckning
61ff9f06e1
1 ändrade filer med 26 tillägg och 13 borttagningar
  1. 26
    13
      example/ios/example/AppDelegate.m

+ 26
- 13
example/ios/example/AppDelegate.m Visa fil

@@ -1,14 +1,9 @@
1
-/**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- */
9
-
10 1
 #import "AppDelegate.h"
11
-#import "RCCManager.h" // <---- NOTICE ME
2
+
3
+// **********************************************
4
+// *** DON'T MISS: THE NEXT LINE IS IMPORTANT ***
5
+#import "RCCManager.h"
6
+
12 7
 #import "RCTRootView.h"
13 8
 
14 9
 @implementation AppDelegate
@@ -39,12 +34,30 @@
39 34
    * generated by "Bundle React Native code and images" build step.
40 35
    */
41 36
 
42
-//   jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
37
+  // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
38
+
43 39
 
40
+  // **********************************************
41
+  // *** DON'T MISS: THIS IS HOW WE BOOTSTRAP ***
42
+  // React Native Controllers bootstrap
44 43
   self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
45 44
   self.window.backgroundColor = [UIColor whiteColor];
46
-  [[RCCManager sharedIntance] initBridgeWithBundleURL:jsCodeLocation]; //<---- NOTICE ME
47
-  
45
+  [[RCCManager sharedIntance] initBridgeWithBundleURL:jsCodeLocation];
46
+
47
+  /*
48
+  // original RN bootstrap - remove this part
49
+  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
50
+                                                      moduleName:@"example"
51
+                                               initialProperties:nil
52
+                                                   launchOptions:launchOptions];
53
+
54
+  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
55
+  UIViewController *rootViewController = [UIViewController new];
56
+  rootViewController.view = rootView;
57
+  self.window.rootViewController = rootViewController;
58
+  [self.window makeKeyAndVisible];
59
+  */
60
+
48 61
   return YES;
49 62
 }
50 63