我正在尝试从AppDelegate
. 我最终有一个例外
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate myViewDelegate]: unrecognized selector sent to instance 0xc07a9b0'
在APPDelegate.h
@interface AppDelegate : NSObject <UIApplicationDelegate> {
MyView *myViewDelegate;
}
@property (nonatomic,strong) MyView *myViewDelegate;
在APPDelegate.m
- (void) _application:(UIApplication *)application commonInitializationLaunching:(NSDictionary *)launchOptions{
...
self.myViewDelegate = [[MyView alloc] init];
}
在MyView.h
我有一个NSDate *d;
@property(nonatomic,strong) NSDate *d;
并且@synthesis d;
在MyView.m
在PaymentView.m
- (void) loadView{
[super loadView];
AppDelegate *del=(AppDelegate *)[[UIApplication sharedApplication] delegate];
del.myViewDelegate.d = myDate;// myDate is a NSDate
}