I have a ViewController and a separate UITableViewController. Now there is an array loaded in the applications appDelegate file, but I do not want to automatically load this. Now I have this code from when I was learning Core Data (still a progress) that detects if the Database is empty, if so then it would insert a default array by calling this method.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self setupFetchedResultsController];
if (![[self.fetchedResultsController fetchedObjects] count] > 0 ) {
NSLog(@"!!!!! ~~> There's nothing in the database so defaults will be inserted");
[self importCoreDataDefaultRoles];
}
else {
NSLog(@"There's stuff in the database so skipping the import of default data");
}
Now as you can see the if statement checks if the count returned is greater than 0.
My question is Can you check this without the use of Core Data? Like with any tableView.
My goal is for the end user to be able to load data into the TableView witha normal NSMutabelArray, but do so via an IBAction button, rather than loading automatically in the viewDidLoad – Just setting myself an exercise:-)
Cheers Jeff
You can at the beginning show default data in the table using an empty array and the when user clicks the button you can insert data in the source array and refresh the table with