Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone “我该如何解决?”;期望表达式“;_Iphone_Ios - Fatal编程技术网

Iphone “我该如何解决?”;期望表达式“;

Iphone “我该如何解决?”;期望表达式“;,iphone,ios,Iphone,Ios,我是新手,所以任何帮助都将不胜感激。提前谢谢 h m 坦率地说,在你的实施过程中似乎发生了炸弹爆炸。首先,您似乎缺少.m开头的@implementation指令。然后,调用[super-viewDidLoad]在iAction中,当它应该位于缺少的viewDidLoad方法中时 此外,您从未在iAction末尾添加右大括号} 您的.h文件应如下所示: #import <UIKit/UIKit.h> @interface ViewController : UIViewControll

我是新手,所以任何帮助都将不胜感激。提前谢谢

h

m


坦率地说,在你的实施过程中似乎发生了炸弹爆炸。首先,您似乎缺少.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