專案 Summery 的 Main Interface 決定MainWindow.xib 開空window時記得加(易忘)
File's owner Class 選 UIApplication
拉Objects 修該其name
Objects Custom Class 選 Delegate file (.h .m)
File's owner的 inspector 下的outlet 下的Delegate 拉向object (名稱會顯示Objects Custom Class 的name)
AppDelegate.h
#import@class ViewController; @interface AppDelegate : UIResponder { UIViewController *NewMain; } @property (strong, nonatomic) UIWindow *window; //@property (strong, nonatomic) ViewController *viewController; @property (strong, nonatomic) IBOutlet UIViewController *NewMain; @end
//self.window.backgroundColor = [UIColor whiteColor];
避免按Home 會消失

AppDelegate.m
@synthesize window = _window; //@synthesize viewController = _viewController; @synthesize NewMain; - (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.window.rootViewController = self.viewController; self.window.rootViewController = self.NewMain; [self.window makeKeyAndVisible]; return YES; } @end易忘 要注意!

沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。