First, create a property in your RootViewController class for the array variable. So e.g. if your array variable is called myArray your code might look something like this:
In RootViewController.h:
#import <UIKit/UIKit.h>
@interface RootViewController : UITableViewController {
NSArray *myArray;
}
@property (nonatomic, retain) NSArray *myArray;
@end
and add the corresponding @synthesize line in RootViewController.m:
#import "RootViewController.h"
@implementation RootViewController
@synthesize myArray;
// methods here
@end
Now you can set the myArray member of a RootViewController object like this:
myRootViewController.myArray = [NSArray arrayWithObjects:@"foo", @"bar", nil];
Now, in your app delegate class, you can use the viewControllers property of self.navigationController to return the view controllers in the navigation stack. The root controller will always be at index 0. viewControllers will return an NSArray, whose elements are of type NSObject, so you need to cast to a RootViewController pointer too. Here it is in two lines, to make the cast explicit:
// get a pointer to the root view controller
id obj = [self.navigationController.viewControllers objectAtIndex:0];
// cast it to a RootViewController pointer
RootViewController* rvc = (RootViewController*)obj;
// Now you can set the array
rvc.myArray = someArray;
(In order to use the RootViewController class name in your app delegate class you'll need to import the relevant header file - put this at the top of TableViewAppDelegate.m:
#import "RootViewController.h"
And that's it!
p.s. Bear in mind that declaring your myArray property as type (nonatomic, retain) means that your RootViewController object will end up pointing to the same instance of NSArray that you pass to it. So, for example:
NSMutableArray *array = [NSMutableArray arrayWithObjects: @"foo", @"bar", nil];
myRootViewController.myArray = array;
[array removeAllObjects]; // myRootViewController.myArray is now empty!
You can use (nonatomic, copy) instead, in which case your RootViewController object will make a copy of the array you pass in and retain that instead. Changes to the array once you've assigned it to your RootViewController object won't affect the copy.