Hello everyone,
My name is Bart, from Belgium, and I'm a student who's started a business with my GF. We sell ice cream & coffee out of a vintage-renovated truck (Citroën HY).
For our business, we're looking for an iPad application, so we can keep track of our sales.
There are many Point of Sales applications available, but they are pricey and we only need the very basics.
I'm a student business engineering with Java experience, but Xcode is new for me. The app should consist of buttons for ice cream, irish coffee, espresso, ... that generates a subtotal the customer has to pay. When clicking on the paid-button, the subtotal should be cleared and the sales for ice cream, coffees, should be updated (in an other window that can be reached when clicking on a "view sales report"-button). Ideally, when clicking on the sale-buttons, a list on the right should appear with the current order (2 coffees, 3 Irish Coffees at a price of x euros for example).
For now, i'm trying to implement buttons and when clicked on, incrementing an integer value for the subtotal the client has to pay.
I'm looking at this: (with the help of Youtube)
viewcontroller.h file:
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
IBOutlet UILabel *subtotaalLbl;
int subtotaal;
}
- (IBAction)Eenbol;
- (IBAction)Tweebol;
- (IBAction)Driebol;
- (IBAction)Supplement;
- (IBAction)IrishCoffee;
- (IBAction)ItalianCoffee;
- (IBAction)FrenchCoffee;
- (IBAction)Koffie;
- (IBAction)Espresso;
- (IBAction)Deca;
- (IBAction)CafeGlace;
@end
viewcontroller.m file:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
subtotaal = 0;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
// Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)Eenbol
{
subtotaal += 1.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Tweebol
{
subtotaal += 2.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Driebol
{
subtotaal += 3.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Supplement
{
subtotaal += 0.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Koffie
{
subtotaal += 2;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Espresso
{
subtotaal += 2;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Deca
{
subtotaal += 3.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)IrishCoffee
{
subtotaal += 5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)ItalianCoffee
{
subtotaal += 5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)FrenchCoffee
{
subtotaal += 5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)CafeGlace
{
subtotaal += 3.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
As I interpret this, I have declared buttons, an integer value and told the program to increment this integer value when clicked on these buttons. I created the buttons and label in the main storyboard file and linked them with the corresponding IBActions.
Still, I got this error:
2014-05-31 21:41:01.885 app kmk[745:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x8d9d210> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key label.'
***
What am I doing wrong? Also, a link to useful websites, extra information is always handy! Thank you in advance.
Bart Meylemans
My name is Bart, from Belgium, and I'm a student who's started a business with my GF. We sell ice cream & coffee out of a vintage-renovated truck (Citroën HY).
For our business, we're looking for an iPad application, so we can keep track of our sales.
There are many Point of Sales applications available, but they are pricey and we only need the very basics.
I'm a student business engineering with Java experience, but Xcode is new for me. The app should consist of buttons for ice cream, irish coffee, espresso, ... that generates a subtotal the customer has to pay. When clicking on the paid-button, the subtotal should be cleared and the sales for ice cream, coffees, should be updated (in an other window that can be reached when clicking on a "view sales report"-button). Ideally, when clicking on the sale-buttons, a list on the right should appear with the current order (2 coffees, 3 Irish Coffees at a price of x euros for example).
For now, i'm trying to implement buttons and when clicked on, incrementing an integer value for the subtotal the client has to pay.
I'm looking at this: (with the help of Youtube)
viewcontroller.h file:
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
IBOutlet UILabel *subtotaalLbl;
int subtotaal;
}
- (IBAction)Eenbol;
- (IBAction)Tweebol;
- (IBAction)Driebol;
- (IBAction)Supplement;
- (IBAction)IrishCoffee;
- (IBAction)ItalianCoffee;
- (IBAction)FrenchCoffee;
- (IBAction)Koffie;
- (IBAction)Espresso;
- (IBAction)Deca;
- (IBAction)CafeGlace;
@end
viewcontroller.m file:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
subtotaal = 0;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
// Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)Eenbol
{
subtotaal += 1.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Tweebol
{
subtotaal += 2.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Driebol
{
subtotaal += 3.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Supplement
{
subtotaal += 0.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Koffie
{
subtotaal += 2;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Espresso
{
subtotaal += 2;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)Deca
{
subtotaal += 3.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)IrishCoffee
{
subtotaal += 5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)ItalianCoffee
{
subtotaal += 5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)FrenchCoffee
{
subtotaal += 5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (IBAction)CafeGlace
{
subtotaal += 3.5;
[subtotaalLbl setText: [NSString stringWithFormat"%d", subtotaal]];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
As I interpret this, I have declared buttons, an integer value and told the program to increment this integer value when clicked on these buttons. I created the buttons and label in the main storyboard file and linked them with the corresponding IBActions.
Still, I got this error:
2014-05-31 21:41:01.885 app kmk[745:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x8d9d210> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key label.'
***
What am I doing wrong? Also, a link to useful websites, extra information is always handy! Thank you in advance.
Bart Meylemans
Last edited: