我正在学习如何创建unwind segue。我创建了两个VC,“ViewoController”和“MessageViewController”。第一个包含一个按钮,而后者嵌入在NavigationController中,它有两个barButtons“取消”和“保存”。
据我所知,要创建展开segue,“MessageViewController”中的“取消”和/或“保存”按钮必须链接到其ViewController中的“MessageViewController”中的EXIT图标。
我遇到的问题是,当我无法将barButton链接到EXIT图标
时请让我知道如何将barBurron链接到EXIT图标,以便将方法“backToViewController”称为
viewController.m
#import "ViewController.h"
#import "MessageViewController.h"
@interface ViewController ()
@property (strong, nonatomic) IBOutlet UIButton *buttonNext;
@end
@implementation ViewController
- (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.
}
-(void) backToViewController:(UIStoryboardSegue *)segue {
}
@end
messageViewController :
#import "MessageViewController.h"
#import "ViewController.h"
@interface MessageViewController ()
@property (strong, nonatomic) IBOutlet UIBarButtonItem
*barButtonSave;
@property (strong, nonatomic) IBOutlet UIBarButtonItem
*barButtonCancel;
@property (strong, nonatomic) IBOutlet UITextField
*textFieldMessage;
@end
@implementation MessageViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
答案 0 :(得分:0)
您的方法签名不太正确。为了让Xcode识别出它用作退出/展开搜索,它需要返回IBAction
。
将其更改为:
- (IBAction) backToViewController:(UIStoryboardSegue *)segue;
应该解决你的问题。