我想分享的观点之间的数据...数据的UIApplication
我有应用程序的TabBar的的appdelegate:
myappdelegate.h
#import <UIKit/UIKit.h>
@interface myappdelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
UIWindow *window;
UITabBarController *tabBarController;
NSString *result;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@property (copy , readwrite) NSString *result;
@end
,如果我想用此命令调用,有提示:“可能不会回应”...
myappdelegate *dataCenter = [(myappdelegate *)[UIApplication sharedApplication] delegate]; <<may not respond
dataCenter.result = @"msg";
result_view *resultView = [[result_view alloc] initWithNibName:@"result_view" bundle:nil];
[self.navigationController pushViewController:resultView animated:YES];
[resultView release];
result_view.m
- (void)viewDidLoad
{
myappdelegate *dataCenter = (myappdelegate*)[[UIApplication sharedApplication]delegate];
[label setText:dataCenter.result];
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
程序崩溃...
由于属性被称为'result',不'result_array'。 – Jilouc 2011-03-23 15:34:30
sry我只是改变了它... – Phil 2011-03-23 15:37:48