Iphone “我该如何解决?”;期望表达式“;
我是新手,所以任何帮助都将不胜感激。提前谢谢 h mIphone “我该如何解决?”;期望表达式“;,iphone,ios,Iphone,Ios,我是新手,所以任何帮助都将不胜感激。提前谢谢 h m 坦率地说,在你的实施过程中似乎发生了炸弹爆炸。首先,您似乎缺少.m开头的@implementation指令。然后,调用[super-viewDidLoad]在iAction中,当它应该位于缺少的viewDidLoad方法中时 此外,您从未在iAction末尾添加右大括号} 您的.h文件应如下所示: #import <UIKit/UIKit.h> @interface ViewController : UIViewControll
坦率地说,在你的实施过程中似乎发生了炸弹爆炸。首先,您似乎缺少.m开头的
@implementation
指令。然后,调用[super-viewDidLoad]代码>在iAction中,当它应该位于缺少的viewDidLoad方法中时
此外,您从未在iAction末尾添加右大括号}
您的.h文件应如下所示:
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
IBOutlet UITextField *textField1;
IBOutlet UITextField *textField2;
IBOutlet UILabel *label1;
}
@end
#import "ViewController.h"
@implementation ViewController
- (IBAction)calculate {
int x = ([textField1.text floatValue]);
int c = x*([textField2.text floatValue]);
}
- (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
它仍然说它希望在-(iAction)calculate{line中有一个表达式,而我缺少@end???是的……但我不知道为什么xcode认为我缺少@end,而它在那里?
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
IBOutlet UITextField *textField1;
IBOutlet UITextField *textField2;
IBOutlet UILabel *label1;
}
@end
#import "ViewController.h"
@implementation ViewController
- (IBAction)calculate {
int x = ([textField1.text floatValue]);
int c = x*([textField2.text floatValue]);
}
- (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