Skip to content

Commit e86bef5

Browse files
author
pera
committed
1 parent b77a9a7 commit e86bef5

File tree

3 files changed

+42
-43
lines changed

3 files changed

+42
-43
lines changed

Sources/ButtonBarViewCell.swift

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,6 @@ import Foundation
2727
open class ButtonBarViewCell: UICollectionViewCell {
2828

2929
@IBOutlet open var imageView: UIImageView!
30-
@IBOutlet open lazy var label: UILabel! = { [unowned self] in
31-
let label = UILabel(frame: self.contentView.bounds)
32-
label.autoresizingMask = [.flexibleWidth, .flexibleHeight]
33-
label.textAlignment = .center
34-
label.font = UIFont.boldSystemFont(ofSize: 14.0)
35-
return label
36-
}()
30+
@IBOutlet open var label: UILabel!
3731

38-
open override func willMove(toSuperview newSuperview: UIView?) {
39-
super.willMove(toSuperview: newSuperview)
40-
41-
if label.superview != nil {
42-
contentView.addSubview(label)
43-
}
44-
}
4532
}

Sources/ButtonCell.xib

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,50 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
47
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
610
</dependencies>
711
<objects>
812
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
913
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
10-
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="ButtonBarViewCell" customModule="XLPagerTabStrip" customModuleProvider="target">
14+
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="zg4-fX-zUF" customClass="ButtonBarViewCell" customModule="XLPagerTabStrip" customModuleProvider="target">
1115
<rect key="frame" x="0.0" y="0.0" width="80" height="40"/>
12-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
13-
<subviews>
14-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4bA-d3-zGi">
15-
<rect key="frame" x="18" y="10" width="45" height="21"/>
16-
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
17-
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
18-
<nil key="highlightedColor"/>
19-
</label>
20-
</subviews>
21-
<color key="backgroundColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="calibratedRGB"/>
16+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
17+
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
18+
<rect key="frame" x="0.0" y="0.0" width="80" height="40"/>
19+
<autoresizingMask key="autoresizingMask"/>
20+
<subviews>
21+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s7f-rk-sQl">
22+
<rect key="frame" x="22" y="12" width="37.5" height="17"/>
23+
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
24+
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
25+
<nil key="highlightedColor"/>
26+
</label>
27+
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="tFG-yJ-6Th">
28+
<rect key="frame" x="22.5" y="2.5" width="35" height="35"/>
29+
<constraints>
30+
<constraint firstAttribute="width" constant="35" id="VRw-5F-5WY"/>
31+
<constraint firstAttribute="height" constant="35" id="ojk-Ug-Lgh"/>
32+
</constraints>
33+
</imageView>
34+
</subviews>
35+
</view>
36+
<color key="backgroundColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2237
<constraints>
23-
<constraint firstAttribute="centerX" secondItem="4bA-d3-zGi" secondAttribute="centerX" id="kcH-EZ-rRx"/>
24-
<constraint firstAttribute="centerY" secondItem="4bA-d3-zGi" secondAttribute="centerY" id="lcE-iT-kgq"/>
38+
<constraint firstItem="tFG-yJ-6Th" firstAttribute="centerY" secondItem="zg4-fX-zUF" secondAttribute="centerY" id="5so-ZP-gRs"/>
39+
<constraint firstItem="tFG-yJ-6Th" firstAttribute="centerX" secondItem="zg4-fX-zUF" secondAttribute="centerX" id="9em-NR-hoa"/>
40+
<constraint firstItem="s7f-rk-sQl" firstAttribute="centerY" secondItem="zg4-fX-zUF" secondAttribute="centerY" id="ZeP-6I-AXE"/>
41+
<constraint firstItem="s7f-rk-sQl" firstAttribute="centerX" secondItem="zg4-fX-zUF" secondAttribute="centerX" id="c15-bZ-hPG"/>
2542
</constraints>
26-
<nil key="simulatedStatusBarMetrics"/>
27-
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
2843
<connections>
29-
<outlet property="label" destination="4bA-d3-zGi" id="Ckx-bG-ZhP"/>
44+
<outlet property="imageView" destination="tFG-yJ-6Th" id="Odb-dR-tf4"/>
45+
<outlet property="label" destination="s7f-rk-sQl" id="4gU-tb-BMB"/>
3046
</connections>
31-
<point key="canvasLocation" x="304" y="552"/>
32-
</view>
47+
<point key="canvasLocation" x="307" y="541"/>
48+
</collectionViewCell>
3349
</objects>
3450
</document>

Sources/IndicatorInfo.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,19 @@ import Foundation
2626

2727
public struct IndicatorInfo {
2828

29-
public var title: String
29+
public var title: String?
3030
public var image: UIImage?
3131
public var highlightedImage: UIImage?
3232

33-
public init(title: String) {
33+
public init(title: String?) {
3434
self.title = title
3535
}
3636

37-
public init(title: String, image: UIImage?) {
38-
self.init(title: title)
37+
public init(image: UIImage?, highlightedImage: UIImage? = nil) {
3938
self.image = image
40-
}
41-
42-
public init(title: String, image: UIImage?, highlightedImage: UIImage?) {
43-
self.init(title: title, image: image)
4439
self.highlightedImage = highlightedImage
4540
}
41+
4642
}
4743

4844

0 commit comments

Comments
 (0)