Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // ViewController.swift
- // test
- //
- // Created by Alessandro Ornano on 22/03/16.
- // Copyright © 2016 Alessandro Ornano. All rights reserved.
- //
- import UIKit
- class ViewController: UIViewController{
- @IBOutlet var infoDetailView: UIView! // Connected to the view in the SceneDock
- override func viewDidLoad() {
- super.viewDidLoad()
- // Cut other vDL code that isn't relevant
- setupInfoView()
- }
- func setupInfoView() {
- infoDetailView.alpha = 0.0
- view.addSubview(infoDetailView)
- updateInfoViewRect(infoDetailView.superview!.bounds.size)
- }
- func updateInfoViewRect(size:CGSize) {
- let viewRect = CGRect(origin: CGPointZero, size: size)
- infoDetailView.frame = viewRect
- infoDetailView.bounds = viewRect
- infoDetailView.layoutIfNeeded()
- infoDetailView.setNeedsDisplay()
- }
- override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
- super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
- updateInfoViewRect(size)
- }
- func hideInfoView() {
- // AFLog.enter(thisClass)
- UIView.animateWithDuration(
- 2.0,
- animations:
- {
- self.infoDetailView.alpha = 0.0
- },
- completion:
- { (finished) in
- return true
- }
- )
- //AFLog.exit(thisClass)
- }
- func showInfoView() {
- //AFLog.enter(thisClass)
- UIView.animateWithDuration(
- 2.0,
- animations:
- {
- self.infoDetailView.alpha = 0.75
- },
- completion:
- { (finished) in
- return true
- }
- )
- //AFLog.exit(thisClass)
- }
- // MARK: - IBActions
- @IBAction func openInfoView(sender: UIButton) {
- showInfoView()
- }
- @IBAction func closeInfoView(sender: UIButton) {
- hideInfoView()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement