[UPDATED POST]
Im going to be posting what I have now after changing star rating controllers. For the storing part I got this:
For what I know its storing the variable thats on statusLabel. Couldnt figure out another way to store a number. On the viewcontroller that I need the stars on I have to put this on the viewdidload:
On this viewconroller I just want to display the stored stars and I noticed that if I change the 0 in self.rateView.rating = 0; to another number (max 5) it will show that many stars. So im looking to make self.rateView.rating = @"rating" but idk how to write that out. Ive tried various ways and cant get it to accept it without errors.
[OLD POST]Hello everyone. Im a bit new to programming and ive been stuck for a couple of days on this problem. Im trying to add a 5 star rating on an app im making. I get it to display just like I want it, but I cant figure out to save my life how to save the rating into the attribute. I currently have 3 attributes other than rating and I get those to store perfectly. I need to store them and then retrieve them on another viewcontroller. I am using mmStarRating controller from here: https://www.iphonelife.com/blog/31369/unleash-your-inner-app-developer-adding-navigation. I will post parts of my script to help out with the brainstorming.
Where I store the info into the attributes (they come from textfields):
How I retrieve the information and display it:
Also I cant figure out what I would change setValue and setText to considering its not a textfield and not a string for what I understand. Thanks in advance.
E.
Im going to be posting what I have now after changing star rating controllers. For the storing part I got this:
Code:
if (Appetizer) {
[Appetizer setValue:dishName.text forKey:@"name"];
[Appetizer setValue:restaurantName.text forKey:@"restaurant"];
[Appetizer setValue:statusLabel.text forKey:@"rating"];
[Appetizer setValue:notes.text forKey:@"notes"];
} else {
NSManagedObject *newAppetizer = [NSEntityDescription insertNewObjectForEntityForName:@"Appetizers" inManagedObjectContext:context];
[newAppetizer setValue:dishName.text forKey:@"name"];
[newAppetizer setValue:restaurantName.text forKey:@"restaurant"];
[newAppetizer setValue:statusLabel.text forKey:@"rating"];
[newAppetizer setValue:notes.text forKey:@"notes"];
Code:
self.rateView.notSelectedImage = [UIImage imageNamed:@"kermit_empty.png"];
self.rateView.halfSelectedImage = [UIImage imageNamed:@"kermit_half.png"];
self.rateView.fullSelectedImage = [UIImage imageNamed:@"kermit_full.png"];
self.rateView.rating = 0;
self.rateView.editable = YES;
self.rateView.maxRating = 5;
self.rateView.delegate = self;
[OLD POST]Hello everyone. Im a bit new to programming and ive been stuck for a couple of days on this problem. Im trying to add a 5 star rating on an app im making. I get it to display just like I want it, but I cant figure out to save my life how to save the rating into the attribute. I currently have 3 attributes other than rating and I get those to store perfectly. I need to store them and then retrieve them on another viewcontroller. I am using mmStarRating controller from here: https://www.iphonelife.com/blog/31369/unleash-your-inner-app-developer-adding-navigation. I will post parts of my script to help out with the brainstorming.
Where I store the info into the attributes (they come from textfields):
Code:
- (IBAction)saveButton:(id)sender {
NSManagedObjectContext *context = [self managedObjectContext];
if (Appetizer) {
[Appetizer setValue:dishName.text forKey:@"name"];
[Appetizer setValue:restaurantName.text forKey:@"restaurant"];
[Appetizer setValue:notes.text forKey:@"notes"];
} else {
NSManagedObject *newAppetizer = [NSEntityDescription insertNewObjectForEntityForName:@"Appetizers" inManagedObjectContext:context];
[newAppetizer setValue:dishName.text forKey:@"name"];
[newAppetizer setValue:restaurantName.text forKey:@"restaurant"];
[newAppetizer setValue:notes.text forKey:@"notes"];
}
}
How I retrieve the information and display it:
Code:
- (void)viewDidLoad
{
[super viewDidLoad];
if (Appetizer) {
[dishName setText:[Appetizer valueForKey:@"name"]];
[restaurantName setText:[Appetizer valueForKey:@"restaurant"]];
[notes setText:[Appetizer valueForKey:@"notes"]];
}
}
Also I cant figure out what I would change setValue and setText to considering its not a textfield and not a string for what I understand. Thanks in advance.
E.
Last edited: