Last active
August 29, 2015 14:02
-
-
Save jerryhjones/3f6963cb349dc5c08180 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SwitchTest.swift | |
// SMPageControlFramework | |
// | |
// Created by Jerry Jones on 6/6/14. | |
// Copyright (c) 2014 Spaceman Labs, Inc. All rights reserved. | |
// | |
import UIKit | |
class SwitchTest: UIView { | |
enum SMPageControlVerticalAlignment { | |
case Top | |
case Middle | |
case Bottom | |
} | |
var verticalAlignment = SMPageControlVerticalAlignment.Middle | |
init(frame: CGRect) { | |
super.init(frame: frame) | |
// Initialization code | |
} | |
func topOffsetForHeight(height: Float, rect: CGRect) -> Float | |
{ | |
var top: Float = 0.0 | |
switch verticalAlignment { | |
case .Middle: | |
top = CGRectGetMidY(rect) - (height / 2.0) | |
case .Bottom: | |
top = CGRectGetMaxY(rect) - height | |
default: | |
top = 0.0 | |
} | |
return 0.0 | |
} | |
} | |
// | |
// SwitchTest.swift | |
// SMPageControlFramework | |
// | |
// Created by Jerry Jones on 6/6/14. | |
// Copyright (c) 2014 Spaceman Labs, Inc. All rights reserved. | |
// | |
import UIKit | |
class SwitchTest: UIView { | |
enum SMPageControlVerticalAlignment { | |
case Top | |
case Middle | |
case Bottom | |
} | |
var verticalAlignment = SMPageControlVerticalAlignment.Middle | |
init(frame: CGRect) { | |
super.init(frame: frame) | |
// Initialization code | |
} | |
func topOffsetForHeight(height: Float, rect: CGRect) -> Float | |
{ | |
var top: Float = 0.0 | |
switch verticalAlignment { | |
case .Middle: | |
top = CGRectGetMidY(rect) - (height / 2.0) | |
case .Bottom: | |
top = CGRectGetMaxY(rect) - height | |
default: | |
top = 0.0 | |
} | |
return 0.0 | |
} | |
} | |
// | |
// SwitchTest.swift | |
// SMPageControlFramework | |
// | |
// Created by Jerry Jones on 6/6/14. | |
// Copyright (c) 2014 Spaceman Labs, Inc. All rights reserved. | |
// | |
import UIKit | |
class SwitchTest: UIView { | |
enum SMPageControlVerticalAlignment { | |
case Top | |
case Middle | |
case Bottom | |
} | |
var verticalAlignment = SMPageControlVerticalAlignment.Middle | |
init(frame: CGRect) { | |
super.init(frame: frame) | |
// Initialization code | |
} | |
func topOffsetForHeight(height: Float, rect: CGRect) -> Float | |
{ | |
var top: Float = 0.0 | |
switch verticalAlignment { | |
case .Middle: | |
top = CGRectGetMidY(rect) - (height / 2.0) | |
case .Bottom: | |
top = CGRectGetMaxY(rect) - height | |
default: | |
top = 0.0 | |
} | |
return 0.0 | |
} | |
} | |
// | |
// SwitchTest.swift | |
// SMPageControlFramework | |
// | |
// Created by Jerry Jones on 6/6/14. | |
// Copyright (c) 2014 Spaceman Labs, Inc. All rights reserved. | |
// | |
import UIKit | |
class SwitchTest: UIView { | |
enum SMPageControlVerticalAlignment { | |
case Top | |
case Middle | |
case Bottom | |
} | |
var verticalAlignment = SMPageControlVerticalAlignment.Middle | |
init(frame: CGRect) { | |
super.init(frame: frame) | |
// Initialization code | |
} | |
func topOffsetForHeight(height: Float, rect: CGRect) -> Float | |
{ | |
var top: Float = 0.0 | |
switch verticalAlignment { | |
case .Middle:// | |
// SwitchTest.swift | |
// SMPageControlFramework | |
// | |
// Created by Jerry Jones on 6/6/14. | |
// Copyright (c) 2014 Spaceman Labs, Inc. All rights reserved. | |
// | |
import UIKit | |
class SwitchTest: UIView { | |
enum SMPageControlVerticalAlignment { | |
case Top | |
case Middle | |
case Bottom | |
} | |
var verticalAlignment = SMPageControlVerticalAlignment.Middle | |
init(frame: CGRect) { | |
super.init(frame: frame) | |
// Initialization code | |
} | |
func topOffsetForHeight(height: Float, rect: CGRect) -> Float | |
{ | |
var top: Float = 0.0 | |
switch verticalAlignment { | |
case .Middle: | |
top = CGRectGe// | |
// SwitchTest.swift | |
// SMPageControlFramework | |
// | |
// Created by Jerry Jones on 6/6/14. | |
// Copyright (c) 2014 Spaceman Labs, Inc. All rights reserved. | |
// | |
import UIKit | |
class SwitchTest: UIView { | |
enum SMPageControlVerticalAlignment { | |
case Top | |
case Middle | |
case Bottom | |
} | |
var verticalAlignment = SMPageControlVerticalAlignment.Middle | |
init(frame: CGRect) { | |
super.init(frame: frame) | |
// Initialization code | |
} | |
func topOffsetForHeight(height: Float, rect: CGRect) -> Float | |
{ | |
var top: Float = 0.0 | |
switch verticalAlignment { | |
case .Middle: | |
top = CGRectGetMidY(rect) - (height / 2.0) | |
case .Bottom: | |
top = CGRectGetMaxY(rect) - height | |
default: | |
top = 0.0 | |
} | |
return 0.0 | |
} | |
} | |
tMidY(rect) - (height / 2.0) | |
case .Bottom: | |
top = CGRectGetMaxY(rect) - height | |
default: | |
top = 0.0 | |
} | |
return 0.0 | |
} | |
} | |
top = CGRectGetMidY(rect) - (height / 2.0) | |
case .Bottom: | |
top = CGRectGetMaxY(rect) - height | |
default: | |
top = 0.0 | |
} | |
return 0.0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment