xCode ViewController 求助!
//AppDelegate.h#import<UIKit/UIKit.h>//import"ViewController.h"@classViewController;@...
// AppDelegate.h
#import <UIKit/UIKit.h>
//import "ViewController.h"
@classViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) IBOutletViewController *CoreDataviewController;
@property (strong, nonatomic) UIWindow *window;
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
@end
// AppDelegate.m#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
@synthesize managedObjectContext = _managedObjectContext;
@synthesize managedObjectModel = _managedObjectModel;
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;
@synthesize CoreDataviewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]];
// Override point for customization after application launch.
CoreDataviewController = [[ViewControlleralloc]initWithNibName: @"ViewController"bundle: nil];
self.window.backgroundColor = [UIColorwhiteColor];
// add the root view controller
[self.windowaddSubview:CoreDataviewController.view];
[self.windowmakeKeyAndVisible];
returnYES;
}
请问 1. appDelegate.h 中为什么用 @class ViewController 代替 #import ViewController.h呀?
2. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{} 这一段是什么作用呀?
多谢~ 展开
#import <UIKit/UIKit.h>
//import "ViewController.h"
@classViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) IBOutletViewController *CoreDataviewController;
@property (strong, nonatomic) UIWindow *window;
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
@end
// AppDelegate.m#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
@synthesize managedObjectContext = _managedObjectContext;
@synthesize managedObjectModel = _managedObjectModel;
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;
@synthesize CoreDataviewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]];
// Override point for customization after application launch.
CoreDataviewController = [[ViewControlleralloc]initWithNibName: @"ViewController"bundle: nil];
self.window.backgroundColor = [UIColorwhiteColor];
// add the root view controller
[self.windowaddSubview:CoreDataviewController.view];
[self.windowmakeKeyAndVisible];
returnYES;
}
请问 1. appDelegate.h 中为什么用 @class ViewController 代替 #import ViewController.h呀?
2. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{} 这一段是什么作用呀?
多谢~ 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询