对于旧版本的 xcode/ios,我使用了:
appDelegate =(AppDelegate *)[[UIApplication sharedApplication] delegate];
访问 AppDelegate
#import "AppDelegate.h"
@property (nonatomic,retain) AppDelegate *appDelegate;
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate> {
}
@property (strong, nonatomic) UIWindow *window;
@end
//-----
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@interface DetailController : UIViewController{
}
@property (nonatomic,retain) AppDelegate *appDelegate;
@end
但在 ios5 AppDelegate 中从 NSObject 更改为 UIRepsonder
是否可以访问 AppDelegate?
欢迎蚂蚁评论