Hi guys so basically this is a project I've been working on and I'm stuck at using coreData while assigning bitwise left shift values to an attribute. Additionally after assigning I would also need to identify them.
Here is an example scenario on what I am trying to do.
Basically let say I have an Entity called Venues with attributes venueName and venueSports. Then I have another Entity called Sports with attribute sportsType and sportsNumber.
So basically: venueName: the venues name - taken from a textboxfield (already have this working) sportsType: the name of the sport - taken from a textboxfield (already have this working)
sportsNumber: so this is where I need a method to store a number and each time I add to the list it uses the bitwise left shift to store the sportNumber.
venueSports: So basically the Sports Entity will generate a tableView which I can select the sports and save it to this venue (already have this) - so now I need to add multiple sports to this attribute which only accepts 1 integer and after I need to identify which bit. So basically if I got 9 I would be getting from 1 8 bit and if I get 14 it would be 2 4 8 bit. How do I do this?
- (NSManagedObjectContext *) managedObjectContext {
NSManagedObjectContext *context = nil;
id delegate = [[UIApplication sharedApplication] delegate];
if ([delegate performSelector:@selector(managedObjectContext)]) {
context = [delegate managedObjectContext];
}
return context;
}
- (IBAction)save:(id)sender {
NSManagedObjectContext *context = [self managedObjectContext];
NSManagedObject *newSport = [NSEntityDescription insertNewObjectForEntityForName:@"Sports" inManagedObjectContext:context];
[newSport setValue:textboxSport.text forKey:@"sportType"];
This is what I have so far which works fine but need the above to features.
Thanks in advance guys I'm new to Objective C so any help is really appreciated.