#import<UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ViewControllerSecond : UIViewController
// Button跳转到下一界面
@property(nonatomic, strong)UIButton* buttonReturn;
@end
NS_ASSUME_NONNULL_END
#import"ViewControllerSecond.h"#import"Masonry.h"
@interface ViewControllerSecond()
@end
@implementation ViewControllerSecond
-(void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.NSLog(@"%s",__func__);
self.view.backgroundColor =[UIColor orangeColor];
_buttonReturn =[UIButton buttonWithType:UIButtonTypeRoundedRect];[_buttonReturn setTitle:@"Return" forState:UIControlStateNormal];[_buttonReturn addTarget:self action:@selector(press) forControlEvents:UIControlEventTouchUpInside];[self.view addSubview:_buttonReturn];[_buttonReturn mas_makeConstraints:^(MASConstraintMaker *make){
make.top.mas_offset(150);
make.left.mas_offset(200);
make.width.mas_offset(200);
make.height.mas_offset(100);}];}-(void)loadView {[super loadView];NSLog(@"%s",__func__);}-(void)viewWillAppear:(BOOL)animated {NSLog(@"%s",__func__);}-(void)viewWillLayoutSubviews {NSLog(@"%s",__func__);}-(void)viewWillDisappear:(BOOL)animated {NSLog(@"%s",__func__);}-(void)viewDidAppear:(BOOL)animated {NSLog(@"%s",__func__);}-(void)viewDidLayoutSubviews {NSLog(@"%s",__func__);}-(void)viewDidDisappear:(BOOL)animated {NSLog(@"%s",__func__);}-(void)press {NSLog(@"-------------Second is Back!--------------");[self dismissViewControllerAnimated:YES completion:nil];}/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
#import<UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ViewControllerSecond : UIViewController
// 返回第一界面的Button
@property(nonatomic, strong)UIButton* buttonReturn;
@end
NS_ASSUME_NONNULL_END
#import"ViewControllerSecond.h"#import"Masonry.h"
@interface ViewControllerSecond()
@end
@implementation ViewControllerSecond
-(void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.NSLog(@"%s",__func__);
self.view.backgroundColor =[UIColor orangeColor];
_buttonReturn =[UIButton buttonWithType:UIButtonTypeRoundedRect];[_buttonReturn setTitle:@"Return" forState:UIControlStateNormal];[_buttonReturn addTarget:self action:@selector(press) forControlEvents:UIControlEventTouchUpInside];[self.view addSubview:_buttonReturn];[_buttonReturn mas_makeConstraints:^(MASConstraintMaker *make){
make.top.mas_offset(150);
make.left.mas_offset(200);
make.width.mas_offset(200);
make.height.mas_offset(100);}];}-(void)loadView {[super loadView];NSLog(@"%s",__func__);}-(void)viewWillAppear:(BOOL)animated {NSLog(@"%s",__func__);}-(void)viewWillLayoutSubviews {NSLog(@"%s",__func__);}-(void)viewWillDisappear:(BOOL)animated {NSLog(@"%s",__func__);}-(void)viewDidAppear:(BOOL)animated {NSLog(@"%s",__func__);}-(void)viewDidLayoutSubviews {NSLog(@"%s",__func__);}-(void)viewDidDisappear:(BOOL)animated {NSLog(@"%s",__func__);}-(void)press {NSLog(@"-------------Second is Back!--------------");[self dismissViewControllerAnimated:YES completion:nil];}/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end