, . AppDelegate, . ( ) - . , StoreVars, , , "". , . .
@interface StoreVars : NSObject
@property (nonatomic) NSArray * mySharedArray;
+ (StoreVars*) sharedInstance;
@implementation StoreVars
@synthesize mySharedArray;
+ (StoreVars*) sharedInstance {
static StoreVars *myInstance = nil;
if (myInstance == nil) {
myInstance = [[[self class] alloc] init];
myInstance.mySharedArray = [NSArray arrayWithObject:@"Test"];
}
return myInstance;
}
. "StoreVars.h" viewControllers, , :
[StoreVars sharedInstance].mySharedArray;
^
, StoreVars. StoreVars . , , 0/.
UINavigationController segues, , "" imo. UIViewController , :
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"YOUR_SEGUE_NAME_HERE"])
{
YourViewController *vc = [segue destinationViewController];
[vc setMyObjectHere:object];
}
}
source: prepareForSegue:
, . , , , . , , . .
.