Created
June 22, 2015 23:48
-
-
Save atomkirk/9ad315ba0849a6fb79d6 to your computer and use it in GitHub Desktop.
This file contains 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
// | |
// 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