Contact Us

Use the form on the right to contact us.

You can edit the text in this area, and change where the contact form on the right submits to, by entering edit mode using the modes on the bottom right. 


Oak Ridge, TN, 37830
United States

Swift-Snips

View Animation - The Slide

Wade Cantley

If you want to slide in or around a view here is how that works.

 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
//Connect to the view in the Storyboard.
@IBOutlet var heading: UILabel!

    
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        
//Move the view from where it was placed 
// in the story board to off screen.
        heading.center.x -= view.bounds.width
        
    }
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
 
//Once the view has loaded, move the 
// heading immediately, and take about 
// a half second to get in its new location 
// which is just the reverse calculation as hiding it.

// We use "easeout" so that it comes in 
//quick and then slows down as it reaches 
// its destination.
        
UIView.animateWithDuration(/*duration:*/ 0.5,
            delay: 0.0,
            options: UIViewAnimationOptions.CurveEaseOut,
            animations: {
            self.heading.center.x += self.view.bounds.width
            
            }, completion: nil)
        
    }