码迷,mamicode.com
首页 > 其他好文 > 详细

01-09 引导页(代码)

时间:2016-01-09 12:18:53      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:

  

//

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

01-09 引导页(代码)

标签:

原文地址:http://www.cnblogs.com/gzz2016/p/5115738.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!