我已经完成了苹果开发者工具资源中的第一个教程,您可以在其中进行输入、标签和按钮,我想要的是,当您按下按钮时,它会将您带到一个新场景,所以我已经设置了 segue,并且我现在将其命名为“testPush”,当我按下按钮时,我实际上如何让它移动我收到一条错误消息
**Thread 1: signal SIGABRT**
它正在回复的代码是这样的
return UIApplicationMain(argc, argv, nil, NSStringFromClass([HelloWorldAppDelegate class]));
任何人都有任何想法,我知道你需要添加代码才能使 segue 工作,但是我所看到的一切都没有意义,或者它只是一段代码,几乎没有关于你如何让它工作的说明等. 感谢任何和所有的帮助
您可能需要的其他东西我不确定场景一是否被调用:HelloWorldViewController场景二被调用:HelloWorldViewController2
编辑
这是我的脚本中的代码,您需要,谢谢。HelloWorldViewController.m
#import "HelloWorldViewController.h"
@interface HelloWorldViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UILabel *label;
- (IBAction)changeGreeting:(id)sender;
@end
@implementation HelloWorldViewController
- (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.
}
- (IBAction)changeGreeting:(id)sender {
self.userName = self.textField.text;
NSString *nameString = self.userName;
if ([nameString length] == 0) {
nameString = @"World";
}
NSString *greeting = [[NSString alloc] initWithFormat:@"Hello, %@!", nameString];
self.label.text = greeting;
}
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
if (theTextField == self.textField) {
[theTextField resignFirstResponder];
}
return YES;
}
@end
HelloWorldViewController.h
#import <UIKit/UIKit.h>
@interface HelloWorldViewController : UIViewController <UITextFieldDelegate>
@property (copy,nonatomic) NSString *userName;
@end
和 main.m
#import <UIKit/UIKit.h>
#import "HelloWorldAppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([HelloWorldAppDelegate class]));
}
}