i'm new to ios. I have a ViewController class that scan a barcode and save the result into an NSMutableArray. Then i want to show the content of the Array in TableView, so need to use that Array in another class.
CODE :
APPDELEGATE.H
@property (nonatomic, strong) ViewController *objViewCont;
APPDELEATE.M
@synthesize objViewCont;
VIEWCONTROLLER.H
@property (nonatomic, retain) NSMutableArray *dataSource;
VIEWCONTROLLER.M
@synthesize dataSource;
...
NSString data = //result of scanning
[dataSource addObject:testData];
TABLEVIEWCONTROLLER.M
#import "ViewController.h"
#import "AppDelegate.h"
....
- (void)viewDidLoad {
[super viewDidLoad];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];
self.navigationItem.rightBarButtonItem = self.editButtonItem;
AppDelegate *objAppDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
// how to populate table with dataSource ????
}
Now, using objAppDelegate.objViewCont.dataSource i have access to the Array. The problem is that : i don't know how to populate the table using dataSource !