Meine Viewcontroller.h sieht so aus:
und die .m Datei so:
Warum bleibt der Bildschirm leer?
Code:
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
__weak IBOutlet UITextField *zahleins;
__weak IBOutlet UITextField *zahlzwei;
__weak IBOutlet UILabel *ergebnis;
__weak IBOutlet UILabel *bemerkung;
}
- (IBAction)doit:(id)sender;
- (IBAction)erase:(id)sender;
@end
und die .m Datei so:
Code:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (IBAction) erase: (id)sender;
{
zahleins.text = @"";
zahlzwei.text = @"";
ergebnis.text = @"";
bemerkung.text = @"";
}
- (IBAction)doit:(id)sender;
{
float x = ([zahleins.text floatValue]);
float y = x * ([zahlzwei.text floatValue]);
ergebnis.text =[[NSString alloc] initWithFormat:@"%2.f", y];
bemerkung.text = @"achso";
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Warum bleibt der Bildschirm leer?