This is my first application that I am trying to do on my own, and I have some questions. I want to have 4 tabs, and in the first title "HomeView" I am parsing JSON data (this has been done so far).
But what I want is some of the data that is being analyzed to be visible on other tabs (and there is no need to analyze it again).
So, parts of my HomeView code are here:
#import "HomeView.h"
@interface HomeView ()
@end
@implementation HomeView
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
parsed_date=[res objectForKey:@"date"];
NSLog(@"Date:%@",parsed_date);
[UIAppDelegate.myArray addObject:parsed_date];
}
and I see that "parsed_date" prints correctly.
So, I want this parsed_date to be visible in OtherView.
This is my code, but I cannot print it.
OtherView.m
#import "OtherView.h"
#import "HomeView.h"
#import "AppDelegate.h"
@interface OtherView ()
@end
@implementation OtherView
@synthesize tracks_date;
- (void)viewDidLoad
{
[super viewDidLoad];
tracks_date = [UIAppDelegate.myArray objectAtIndex:0];
NSLog(@"Dated previed in OtherView: %@", tracks_date);
}
and (null).
delegate.h application code added
#import <UIKit/UIKit.h>
#define UIAppDelegate ((AppDelegate *)[UIApplication sharedApplication].delegate)
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, strong) NSArray *myArray;
@end
So can you offer me a solution?
source
share