博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
界面跳转
阅读量:4949 次
发布时间:2019-06-11

本文共 3627 字,大约阅读时间需要 12 分钟。

//  MyFirstViewController.h

//  MyUI6-1

//

//  Created by tlh on 16/3/14.

//  Copyright © 2016年 lamco. All rights reserved.

//

 

#import <UIKit/UIKit.h>

#import "MySecondViewControler.h"

@interface MyFirstViewController : UIViewController

@property(strong,nonatomic)UIButton *btn;

@end

//  MyFirstViewController.m

//  MyUI6-1

//

//  Created by tlh on 16/3/14.

//  Copyright © 2016年 lamco. All rights reserved.

//

 

#import "MyFirstViewController.h"

 

@interface MyFirstViewController ()

 

@end

 

@implementation MyFirstViewController

 

- (void)viewDidLoad {

    [super viewDidLoad];

    self.view.backgroundColor=[UIColor blueColor];

    

    self.btn=[UIButton buttonWithType:UIButtonTypeRoundedRect];

    self.btn.frame=CGRectMake(100, 100, 100, 50);

    self.btn.backgroundColor=[UIColor greenColor];

    [self.btn addTarget:self action:@selector(next) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:self.btn];

}

 

 

-(void)next

{

    

    MySecondViewControler *mysec=[[MySecondViewControler alloc]init];

    

//    设置模态视图页面切换方式

    mysec.modalTransitionStyle=3;

//    模态视图

    [self presentViewController:mysec animated:YES completion:^{NSLog(@"页面切换完毕");}];

    

}

 

//  MySecondViewControler.h

//  MyUI6-1

//

//  Created by tlh on 16/3/14.

//  Copyright © 2016年 lamco. All rights reserved.

//

 

#import <UIKit/UIKit.h>

#import "MyThirdViewController.h"

@interface MySecondViewControler : UIViewController

@property(strong,nonatomic)UIButton *btn;

 

 

//  Created by tlh on 16/3/14.

//  Copyright © 2016年 lamco. All rights reserved.

//

 

#import "MySecondViewControler.h"

 

@interface MySecondViewControler ()

 

@end

 

@implementation MySecondViewControler

 

- (void)viewDidLoad {

    [super viewDidLoad];

    

    self.btn=[UIButton buttonWithType:UIButtonTypeRoundedRect];

    self.btn.frame=CGRectMake(100, 100, 100, 50);

    self.btn.backgroundColor=[UIColor redColor];

    [self.btn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:self.btn];

    

   

    self.view.backgroundColor=[UIColor greenColor];

    

}

-(void)back

{

    隐藏  返回上一页

//    [self dismissViewControllerAnimated:YES completion:^{

//        NSLog(@"front page show");

//    }];

    

    

   MyThirdViewController *mysec=[[MyThirdViewController alloc]init];

    [self presentViewController:mysec animated:YES completion:^{NSLog(@"页面切换");}];

    

}

- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}

 

//  MyThirdViewController.h

//  MyUI6-1

//

//  Created by tlh on 16/3/14.

//  Copyright © 2016年 lamco. All rights reserved.

//

 

#import <UIKit/UIKit.h>

#import "MyFirstViewController.h"

@interface MyThirdViewController : UIViewController

@property(strong,nonatomic)UIButton *btn;

@end

//  MyThirdViewController.m

//  MyUI6-1

//

//  Created by tlh on 16/3/14.

//  Copyright © 2016年 lamco. All rights reserved.

//

 

#import "MyThirdViewController.h"

 

@interface MyThirdViewController ()

 

@end

 

@implementation MyThirdViewController

 

- (void)viewDidLoad {

    [super viewDidLoad];

    

    self.view.backgroundColor=[UIColor redColor];

    

//    self.btn=[UIButton buttonWithType:UIButtonTypeRoundedRect];

//    self.btn.frame=CGRectMake(100, 100, 100, 50);

//    self.btn.backgroundColor=[UIColor greenColor];

//    [self.btn addTarget:self action:@selector(next) forControlEvents:UIControlEventTouchUpInside];

//    [self.view addSubview:self.btn];

    

    // Do any additional setup after loading the view.

}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event

{

    [self presentViewController:[MyFirstViewController new] animated:YES completion:nil];

}

- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}

 

转载于:https://www.cnblogs.com/tianlianghong/p/5277228.html

你可能感兴趣的文章
python 去掉换行符或者改为其他方式结尾的方法(end='')
查看>>
数据模型(LP32 ILP32 LP64 LLP64 ILP64 )
查看>>
REST构架风格介绍:状态表述转移
查看>>
struct {0}初始化
查看>>
c++ operator
查看>>
apache 添加 ssl_module
查看>>
java小技巧
查看>>
POJ 3204 Ikki's Story I - Road Reconstruction
查看>>
getQueryString
查看>>
Servlet文件上传和下载的复习
查看>>
JavaScript笔记——正则表达式
查看>>
iOS PushMebaby
查看>>
网页消息类
查看>>
【BZOJ】2959: 长跑(lct+缩点)(暂时弃坑)
查看>>
日常一些出现bug的问题
查看>>
同时启动多个tomcat服务器
查看>>
怎么将iphone上的照片导出到本地文件
查看>>
Repeater+DataPagerSource分页
查看>>
模块化导出
查看>>
pagebean pagetag java 后台代码实现分页 demo 前台标签分页 后台java分页
查看>>