Skip to content

Instantly share code, notes, and snippets.

@atomkirk
Created June 22, 2015 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atomkirk/9ad315ba0849a6fb79d6 to your computer and use it in GitHub Desktop.
Save atomkirk/9ad315ba0849a6fb79d6 to your computer and use it in GitHub Desktop.
//
// Created by Adam Kirk on 6/22/15.
//
import UIKit
extension UIScrollView {
var contentOffsetX: CGFloat {
get {
return self.contentOffset.x
}
set {
var p = self.contentOffset
p.x = newValue
self.contentOffset = p
}
}
var contentOffsetY: CGFloat {
get {
return self.contentOffset.y
}
set {
var p = self.contentOffset
p.y = newValue
self.contentOffset = p
}
}
var contentInsetTop: CGFloat {
get {
return self.contentInset.top
}
set {
var p = self.contentInset
p.top = newValue
self.contentInset = p
}
}
var contentInsetBottom: CGFloat {
get {
return self.contentInset.bottom
}
set {
var p = self.contentInset
p.bottom = newValue
self.contentInset = p
}
}
var contentInsetLeft: CGFloat {
get {
return self.contentInset.left
}
set {
var p = self.contentInset
p.left = newValue
self.contentInset = p
}
}
var contentInsetRight: CGFloat {
get {
return self.contentInset.right
}
set {
var p = self.contentInset
p.right = newValue
self.contentInset = p
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment