2
何が間違っていますか?配列を記録しようとすると、コードがクラッシュします。ここに私のクラスはあります:共有NSArray 1つのクラス内の複数のメソッド間の内容
@interface ArrayTestAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
NSArray *array;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) NSArray *array;
-(IBAction)buttonPressed;
@end
@implementation ArrayTestAppDelegate
@synthesize window, array;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
array = [NSArray arrayWithObjects:@"Banana", @"Apple", @"Orange", @"Pear", @"Plum", nil];
[window makeKeyAndVisible];
}
-(IBAction)buttonPressed {
NSLog(@"%@", array);
}
- (void)dealloc {
[window release];
[array release];
[super dealloc];
}
@end