#import<UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SecondViewController : UIViewController
@property(nonatomic, strong)UIButton* buttonNextTwo;
@property(nonatomic, strong) UIButton* backButton;
@end
NS_ASSUME_NONNULL_END
#import"SecondViewController.h"#import"ThirdViewController.h"
@interface SecondViewController()
@end
@implementation SecondViewController
-(void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.
_buttonNextTwo =[UIButton buttonWithType:UIButtonTypeRoundedRect];[_buttonNextTwo setTitle:@"Next" forState:UIControlStateNormal];[_buttonNextTwo addTarget:self action:@selector(pressButtonNext) forControlEvents:UIControlEventTouchUpInside];
_buttonNextTwo.frame =CGRectMake(120,200,120,40);[self.view addSubview:_buttonNextTwo];
_backButton =[UIButton buttonWithType:UIButtonTypeRoundedRect];[_backButton setTitle:@"BAck"forState:UIControlStateNormal];[_backButton addTarget:self action:@selector(pressBack) forControlEvents:UIControlEventTouchUpInside];
_backButton.frame =CGRectMake(120,400,120,40);[self.view addSubview:_backButton];}-(void)pressButtonNext {
ThirdViewController* thirdView =[[ThirdViewController alloc] init];
thirdView.view.backgroundColor =[UIColor blueColor];[self.navigationController pushViewController:thirdView animated:YES];}-(void)pressBack {[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