博客> iOS-设置程序启动页后的广告页
iOS-设置程序启动页后的广告页
2019-10-10 12:11 评论:0 阅读:963 OS_JJ
ios iOS-设置程序启动页后的广告页

//判断 NSUserDefaults standardUserDefaults 是否存在 if (![[NSUserDefaults standardUserDefaults] boolForKey:@"是否第一次"]) {

        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"是否第一次"];
        UIViewController *viewController = [[UIViewController alloc]init];
        self.window.rootViewController = viewController;
        self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT )];
        self.scrollView.pagingEnabled = YES;
        self.scrollView.showsHorizontalScrollIndicator = NO;
        self.scrollView.showsVerticalScrollIndicator = NO;
        self.scrollView.contentSize = CGSizeMake(WIDTH * 4, HEIGHT);
        [viewController.view addSubview:self.scrollView];

        //启动页的滑动页面
        NSArray *picArray = [[NSArray alloc] initWithObjects:@"1200-1", @"1200-2",@"1200-3",@"1200-4",nil];

        for (int i = 0; i < picArray.count; i++) {
            UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH * i, 0, WIDTH, HEIGHT)];
            imageView.image = [UIImage imageNamed:[picArray objectAtIndex:i]];
            [self.scrollView addSubview:imageView];
        }
        UIButton *go = [UIButton buttonWithType:UIButtonTypeCustom];
        go.frame = CGRectMake(WIDTH * (picArray.count - 1) , 0 , WIDTH, HEIGHT);
        [go addTarget:self action:@selector(createTabBar) forControlEvents:1<&lt;6];
        [self.scrollView addSubview:go];
    }else{
        [self createTabBar];
    }
收藏
0
sina weixin mail 回到顶部