• 01-09 引导页(代码 1 )


      

    //

    //  GuideViewController.m

    //  XuanMiLaywer

    //

    //  Created by MYMAc on 15/7/30.

    //  Copyright (c) 2015 zhiyou. All rights reserved.

    //

     

     

    #import "GuideViewController.h"

    #import "AppDelegate.h"

    #import "LoginViewController.h"

     

    @interface GuideViewController ()<UIApplicationDelegate>

    {

        NSArray * imageArr;

        UIImageView *imageview;

        UIScrollView *scrollView ;

     

    }

    @end

     

    @implementation GuideViewController

     

     

     

     

    - (void)viewDidLoad {

        [super viewDidLoad];

     

       [[self navigationController] setNavigationBarHidden:YES animated:NO];

       imageArr = [[NSArray alloc]initWithObjects:@"gdyidaoye1", @"gdyidaoye2", @"gdyidaoye3",nil];

        

        [self initView];

        [self prefersStatusBarHidden];

    }

     

    #pragma mark  主页面

    -(void)initView

    {

       scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];

        scrollView.showsVerticalScrollIndicator=NO;

        scrollView.showsHorizontalScrollIndicator=NO;

        [scrollView setContentSize:CGSizeMake(SCREEN_WIDTH * 3, 0)];

        [scrollView setPagingEnabled:YES];  //视图整页显示

           [scrollView setBounces:NO]; //避免弹跳效果,避免把根视图露出来

        for (int i = 0; i < imageArr.count; i ++) {

            imageview = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH * i, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];

            imageview.image=[UIImage imageNamed:[NSString stringWithFormat:@"%@",imageArr[i]]];

            imageview.userInteractionEnabled = YES;

            [scrollView addSubview:imageview];

        }

        

        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

        button.frame=CGRectMake(SCREEN_WIDTH/2-50, SCREEN_HEIGHT-40, 100, 30);

    //    [button setBackgroundImage:[UIImage imageNamed:@"yindaoBg"] forState:UIControlStateNormal];

    //    [button setBackgroundImage:[UIImage imageNamed:@"yindaoBg"] forState:UIControlStateHighlighted];

        [button addTarget:self action:@selector(firstpressed) forControlEvents:UIControlEventTouchUpInside];

        [button setTitleColor:RGB(60, 199, 192) forState:UIControlStateNormal];

        button.backgroundColor = [UIColor whiteColor];

        button.layer.masksToBounds = YES;

        button.layer.cornerRadius = 5;

        [button setTitle:@"开始体验" forState:UIControlStateNormal];

        [imageview addSubview:button];

        

        

        [self.view addSubview:scrollView];

        

        

    }

    - (void)firstpressed

    {

        

        NSUserDefaults *userdefa =[NSUserDefaults standardUserDefaults];

        [userdefa setBool:YES forKey:@"MMIsFirst"];

        [userdefa synchronize];

        AppDelegate * appdelegatee = [UIApplication sharedApplication].delegate;

    //    BaseTB =[[BaseTBViewController alloc]init];

        

    //     appdelegatee.window.rootViewController  = BaseTB;

        //点击button跳转到根视图

    //    AppDelegate * appdelegatee = [UIApplication sharedApplication].delegate;

    //    [self presentViewController:appdelegatee.tabBar animated:YES completion:^

    //    {

    //

    //         appdelegatee.window.rootViewController =appdelegatee.tabBar;

    //        

    //    }];

        LoginViewController *log=[[LoginViewController alloc]init];

        

        UINavigationController *logNav=[[UINavigationController alloc]initWithRootViewController:log];

        appdelegatee.window.rootViewController =logNav;

        

    }

    - (BOOL)prefersStatusBarHidden

    {

        return YES;

    }

    - (void)didReceiveMemoryWarning {

        [super didReceiveMemoryWarning];

        // Dispose of any resources that can be recreated.

    }

     

     

    @end

  • 相关阅读:
    【工具篇】抓包中的王牌工具—Fiddler (2-工具介绍)
    SQL注入攻击的常见方式及测试方法
    Xshell访问和连接Linux
    【户口篇】换房过程中,户口怎么迁移?
    【计算机篇】二维码解析、短地址生成器
    【工具篇】Sublime Text 2/3 安装汉化破解、插件包安装教程详解
    【通用】登录功能测试用例
    【工具篇】接口测试神器 -- Postman 入门教程
    【生活篇】微信运动刷步,高达98000!微信运动计步作弊教程!
    关于The C compiler "arm-none-eabi-gcc" is not able to compile a simple test program. 的错误自省...
  • 原文地址:https://www.cnblogs.com/gzz2016/p/5115738.html
Copyright © 2020-2023  润新知