fix crash when try to remove observer.
This commit is contained in:
parent
17f2e05ae4
commit
6e4a319bb6
|
|
@ -94,9 +94,20 @@
|
|||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kmN-fg-NDL">
|
||||
<rect key="frame" x="21" y="82" width="46" height="34"/>
|
||||
<state key="normal" title="Close">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="closeTapped:" destination="uba-Iz-2L2" eventType="touchUpInside" id="B1v-kE-kC0"/>
|
||||
<action selector="reloadTapped:" destination="uba-Iz-2L2" eventType="touchUpInside" id="73B-ps-jro"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="kmN-fg-NDL" firstAttribute="top" secondItem="Emc-3r-MJi" secondAttribute="bottom" constant="62" id="7Rq-MO-b4m"/>
|
||||
<constraint firstItem="cZN-qT-VUq" firstAttribute="leading" secondItem="Mqm-sG-Qyv" secondAttribute="leadingMargin" id="9eC-5j-2zk"/>
|
||||
<constraint firstAttribute="centerX" secondItem="cZN-qT-VUq" secondAttribute="centerX" id="AYy-gw-Ryh"/>
|
||||
<constraint firstItem="NbE-e0-l2n" firstAttribute="top" secondItem="qkQ-UG-MKG" secondAttribute="bottom" id="K6Q-s5-nzV"/>
|
||||
|
|
@ -107,6 +118,7 @@
|
|||
<constraint firstItem="jSE-G2-qe6" firstAttribute="trailing" secondItem="Mqm-sG-Qyv" secondAttribute="trailingMargin" id="hbB-fi-M5S"/>
|
||||
<constraint firstItem="qkQ-UG-MKG" firstAttribute="top" secondItem="Emc-3r-MJi" secondAttribute="bottom" constant="101" id="nJw-ag-ddh"/>
|
||||
<constraint firstAttribute="trailing" secondItem="qkQ-UG-MKG" secondAttribute="trailing" id="pTb-BC-Duc"/>
|
||||
<constraint firstItem="kmN-fg-NDL" firstAttribute="leading" secondItem="Mqm-sG-Qyv" secondAttribute="leadingMargin" constant="1" id="sXd-CC-BrV"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
|
|
|
|||
|
|
@ -65,6 +65,11 @@ class ReloadExampleViewController: UIViewController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@IBAction func closeTapped(sender: UIButton) {
|
||||
dismissViewControllerAnimated(true, completion: nil)
|
||||
}
|
||||
|
||||
func updateTitle(pagerTabStripViewController: PagerTabStripViewController) {
|
||||
func stringFromBool(bool: Bool) -> String {
|
||||
return bool ? "YES" : "NO"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<a href="https://raw.githubusercontent.com/xmartlabs/XLPagerTabStrip/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" /></a>
|
||||
</p>
|
||||
|
||||
Made with ❤️ by [Xmartlabs](http://xmartlabs.com).
|
||||
Made with ❤️ by [Xmartlabs](http://xmartlabs.com).
|
||||
|
||||
Android [PagerTabStrip](http://developer.android.com/reference/android/support/v4/view/PagerTabStrip.html) for iOS!
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ We may need to update the indicator cell when the displayed view controller chan
|
|||
public var changeCurrentIndex: ((oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, animated: Bool) -> Void)?
|
||||
public var changeCurrentIndexProgressive: ((oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void)?
|
||||
|
||||
Let's see am example:
|
||||
Let's see an example:
|
||||
|
||||
```swift
|
||||
changeCurrentIndexProgressive = { (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
|
||||
|
|
|
|||
|
|
@ -43,14 +43,14 @@ public class TwitterPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
|
||||
public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
pagerBehaviour = .Common(skipIntermediateViewControllers: true)
|
||||
pagerBehaviour = .Progressive(skipIntermediateViewControllers: true, elasticIndicatorLimit: true)
|
||||
delegate = self
|
||||
datasource = self
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
pagerBehaviour = PagerTabStripBehaviour.Common(skipIntermediateViewControllers: true)
|
||||
pagerBehaviour = .Progressive(skipIntermediateViewControllers: true, elasticIndicatorLimit: true)
|
||||
delegate = self
|
||||
datasource = self
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ public class TwitterPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
titleView.addSubview(pageControl)
|
||||
reloadNavigationViewItems()
|
||||
}
|
||||
|
||||
|
||||
public override func reloadPagerTabStripView() {
|
||||
super.reloadPagerTabStripView()
|
||||
guard isViewLoaded() else { return }
|
||||
|
|
@ -123,7 +123,7 @@ public class TwitterPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
}
|
||||
|
||||
deinit {
|
||||
titleView.removeObserver(self, forKeyPath: "frame")
|
||||
NSNotificationCenter.defaultCenter().removeObserver(self)
|
||||
}
|
||||
|
||||
public override func viewDidLayoutSubviews() {
|
||||
|
|
@ -133,7 +133,7 @@ public class TwitterPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
|
||||
// MARK: - Helpers
|
||||
|
||||
private lazy var titleView: UIView = { [unowned self] in
|
||||
private lazy var titleView: UIView = {
|
||||
let navigationView = UIView()
|
||||
navigationView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
|
||||
return navigationView
|
||||
|
|
|
|||
Loading…
Reference in New Issue