i want to share data between views...
i have the appdelegate of tabbar application:
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
if i want to call with this command, there is the hint: "may not respond"....
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.
}
the program crashes...