Hi Tarek, I am trying to build in a an STV Controller into an existing project. I am getting two warning messages as follows:
: 'SCClassDefinition' may not respond to '+definitionWithEntityName:withManagedObjectContext:withPropertyNames:'
and"
warning: no '-initWithTableView:withViewController:withEntityClassDefinition:' method found.
A section of code is below where the errors occur. If you would please give me some pointers of where to look...
Also, maybe this is serious enough to start from scratch?
Thanks
David
- (void)viewDidLoad {
[super viewDidLoad];
// Set up the edit and add buttons.
self.navigationItem.leftBarButtonItem =
self.editButtonItem;
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:nil];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];
// Get managedObjectContext from application delegate
NSManagedObjectContext *managedObjectContext = [(AppDelegate *)[UIApplication sharedApplication].delegate managedObjectContext];
// Create a class definition for CardEntity
SCClassDefinition *cardDef =
[SCClassDefinition definitionWithEntityName:@"CardEntity" withManagedObjectContext:managedObjectContext
withPropertyNames:[NSArray arrayWithObjects:@"frontWord", @"backWord", @"notes", @"tableStuff", nil]];
//property definition customization
SCPropertyDefinition *cardPropertyDef = [cardDef propertyDefinitionWithName:@"frontWord"];
cardPropertyDef.attributes = [SCArrayOfObjectsAttributes attributesWithObjectClassDefinition:cardDef
allowAddingItems:YES
allowDeletingItems:YES
allowMovingItems:NO];
((SCArrayOfObjectsAttributes *)cardPropertyDef.attributes).allowEditingItems = NO;
// Instantiate the tabel model
tableModel = [[SCArrayOfObjectsModel alloc] initWithTableView:self.tableView withViewController:self
withEntityClassDefinition:cardDef];
tableModel.searchBar = self.searchBar;
tableModel.searchPropertyName = @"frontWord";
tableModel.addButtonItem = self.navigationItem.rightBarButtonItem;
tableModel.autoSortSections = TRUE;
tableModel.sectionIndexTitles = [NSArray arrayWithObjects:@"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I", @"J", @"K", @"L", @"M", @"N", @"O", @"P", @"Q", @"R", @"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z", nil];
// no need to add any sections as SCArrayOfObjectsModel automatically generates its sections
// from the SCTableViewModelDataSource method implemented below
}