From fa24aaee8b2b9430180784dbcd8c51817af62b64 Mon Sep 17 00:00:00 2001 From: Xin Hong Date: Thu, 3 Nov 2016 12:50:28 +0800 Subject: [PATCH] support rectForSegment public function --- SegmentedControl/SegmentedControl.swift | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/SegmentedControl/SegmentedControl.swift b/SegmentedControl/SegmentedControl.swift index 900220a..2d95280 100644 --- a/SegmentedControl/SegmentedControl.swift +++ b/SegmentedControl/SegmentedControl.swift @@ -90,6 +90,15 @@ open class SegmentedControl: UIControl { } } open fileprivate(set) var isLongPressActivated = false + open var scrollContentInset: UIEdgeInsets { + return scrollView.contentInset + } + open var scrollContentSize: CGSize { + return scrollView.contentSize + } + open var scrollContentOffset: CGPoint { + return scrollView.contentOffset + } fileprivate lazy var scrollView: SCScrollView = { let scrollView = SCScrollView() @@ -153,6 +162,25 @@ open class SegmentedControl: UIControl { } } + open func rectForSegment(at index: Int) -> CGRect? { + guard 0..