-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWelcomeViewController.swift
More file actions
46 lines (35 loc) · 1.32 KB
/
Copy pathWelcomeViewController.swift
File metadata and controls
46 lines (35 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// WelcomeViewController.swift
// CarouselDevine
//
// Created by WilliamDevine on 9/21/14.
// Copyright (c) 2014 WilliamDevine. All rights reserved.
//
import UIKit
class WelcomeViewController: UIViewController, UIScrollViewDelegate {
@IBOutlet weak var welcomeScrollView: UIScrollView!
@IBOutlet weak var welcomePageControl: UIPageControl!
@IBOutlet weak var takeSpinButton: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
takeSpinButton.alpha = 0
welcomeScrollView.contentSize = CGSizeMake(1280, 568)
welcomeScrollView.delegate = self
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func scrollViewDidEndDecelerating(scrollView: UIScrollView!) {
// Get the current page based on the scroll offset
var page = Int(welcomeScrollView.contentOffset.x / 320)
// Set the current page, so the dots will update
welcomePageControl.currentPage = page
if (welcomeScrollView.contentOffset.x == 960) {
UIView.animateWithDuration(0.8) {
self.takeSpinButton.alpha = 1
}
}
}
}