zoukankan      html  css  js  c++  java
  • 界面跳转

    //  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.

    }

  • 相关阅读:
    序列——堆排序-大根堆(堆大顶)
    3 分钟的高速体验 Apache Spark SQL
    UVa 1401 Remember the Word
    leetcode
    oracle看到用户的所有表名、表睐、字段名称、现场的目光、是空的、字段类型
    cocos2d-x物业现场
    Unable to start MySQL service. Another MySQL daemon is already running with the same UNIX socket
    ThreadPoolExecutor详解
    Java四种线程池newCachedThreadPool,newFixedThreadPool,newScheduledThreadPool,newSingleThreadExecutor
    A First Exploration Of SolrCloud
  • 原文地址:https://www.cnblogs.com/tianlianghong/p/5277228.html
Copyright © 2011-2022 走看看