Last active
September 29, 2015 22:22
-
-
Save MTattin/c2e1e5c21c9de0b7487b to your computer and use it in GitHub Desktop.
Storyboardにxib利用 ref: http://qiita.com/MTattin/items/61beb3b4afcc779f707f
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
class VideoNavView: UIView { | |
private var v: UIView? | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
v = NSBundle.mainBundle().loadNibNamed( | |
"VideoNavView", | |
owner: self, | |
options: nil | |
)[0] as? UIView | |
self.addSubview(v!) | |
} | |
} |
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
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
v = NSBundle.mainBundle().loadNibNamed( | |
"VideoNavView", | |
owner: self, | |
options: nil | |
)[0] as? UIView | |
self.addSubview(v!) | |
/* Viewのカスタム */ | |
spdSdr.setThumbImage( | |
UIImage(named: "spdSdrThum"), | |
forState: UIControlState.Normal | |
) | |
spdSdr.setThumbImage( | |
UIImage(named: "spdSdrThum"), | |
forState: UIControlState.Highlighted | |
) | |
spdSdr.setThumbImage( | |
UIImage(named: "spdSdrThum"), | |
forState: UIControlState.Selected | |
) | |
} |
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
override func drawRect(rect: CGRect) { | |
super.drawRect(rect) | |
/* スライダーの右端と左端にViewを配置 */ | |
var posStBtnR: CGRect = posStBtn.frame | |
posStBtnR.x = posSdr.x - (posStBtnR.w * 0.5) | |
posStBtnR.y = posSdr.y + (posSdr.h * 0.5) | |
posStBtn.frame = posStBtnR | |
var posSpBtnR: CGRect = posSpBtn.frame | |
posSpBtnR.x = posSdr.x + posSdr.w - (posStBtnR.w * 0.5) | |
posSpBtnR.y = posSdr.y + (posSdr.h * 0.5) | |
posSpBtn.frame = posSpBtnR | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment