不能 link 退出图标的按钮

can't link a button to EXIT icon

我正在学习如何创建展开转场。我创建了两个 VC,“ViewoController”和“MessageViewController”。第一个包含一个按钮,而后者嵌入在 NavigationController 中,它有两个 barButtons“取消”和“保存”。

据我所知,要创建展开转场,必须将“消息ViewController”中的“取消”and/or“保存”按钮link编辑到其 ViewController 中的 EXIT 图标 „MessageViewController“。

我遇到的问题是,当我无法 link 退出图标的 barButton

请告诉我如何将 barBurron link 设置为退出图标,以便调用 "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

留言ViewController:

 #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.
 }

您的方法签名不太正确。为了 Xcode 将其识别为用作 Exit / Unwind Segue,它需要 return IBAction.

将其更改为:

- (IBAction) backToViewController:(UIStoryboardSegue *)segue;

应该可以解决您的问题。