Skip to content

Instantly share code, notes, and snippets.

@jerryhjones
Last active August 29, 2015 14:02
Show Gist options
  • Save jerryhjones/3f6963cb349dc5c08180 to your computer and use it in GitHub Desktop.
Save jerryhjones/3f6963cb349dc5c08180 to your computer and use it in GitHub Desktop.
//
// 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