У меня есть набор атрибутов комнаты (NSString), я сохранил их в CoreData.Как я могу получить их, чтобы показать его в UILabel?
Я попробовал это в viewDidLoad:
NSArray *array = [[currentRaum raumattribute] allObjects];
[roomAttributLabel setText:[NSString stringWithFormat:@"%@",array]];
, но это не сработало.он показывает некоторый код основных данных Снимок экрана
Вот как я могу сохранить свое содержимое:
Raum *raum2 = [NSEntityDescription insertNewObjectForEntityForName:@"Raum" inManagedObjectContext:context];
raum2.raumName = @"Main";
raum2.ort = @"Aschaffenburg";
raum2.strasse = @"Bruchtannenstr. 11";
raum2.etage = @"2. Stock, Raum 1.203";
raum2.beschreibung = @"Gut beleuchtet";
UIImage *img2 = [UIImage imageNamed:@"Main.jpg"];
NSData *data2 = UIImagePNGRepresentation(img2);
raum2.foto = data2;
NSSet *attributeFurRaum2 = [NSSet setWithObjects:attribute4,attribute5,attribute6,nil];
raum2.raumattribute= attributeFurRaum2;
Декларация currentRaum:
self.currentRaum = [self.fetchedResultsController objectAtIndexPath:indexPath];
iожидается 3 разных строки NSS, которые сохраняются так:
Raumattribute *attribute4 =[NSEntityDescription insertNewObjectForEntityForName:@"Raumattribute" inManagedObjectContext:context];
attribute4.attributname = @"Copyboard";
Raumattribute *attribute5 =[NSEntityDescription insertNewObjectForEntityForName:@"Raumattribute" inManagedObjectContext:context];
attribute5.attributname = @"Flipchart";
Raumattribute *attribute6 =[NSEntityDescription insertNewObjectForEntityForName:@"Raumattribute" inManagedObjectContext:context];
attribute6.attributname = @"Internetmöglichkeit";