Skip to content

Commit

Permalink
fixed #59
Browse files Browse the repository at this point in the history
  • Loading branch information
tilltue committed Dec 29, 2017
1 parent 514d56d commit ec8979d
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 8 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ viewController.configure = configure
public struct TLPhotosPickerConfigure {
public var defaultCameraRollTitle = "Camera Roll"
public var tapHereToChange = "Tap here to change"
public var cancelTitle = "Cancel"
public var doneTitle = "Done"
public var emptyMessage = "No albums"
public var emptyImage: UIImage? = nil
public var usedCameraButton = true
public var usedPrefetch = false
public var allowedLivePhotos = true
Expand All @@ -172,6 +176,7 @@ public struct TLPhotosPickerConfigure {
public var muteAudio = true
public var mediaType: PHAssetMediaType? = nil
public var numberOfColumn = 3
public var singleSelectedMode = false
public var maxSelectedAssets: Int? = nil //default: inf
public var fetchOption: PHFetchOptions? = nil //default: creationDate
public var singleSelectedMode = false
Expand Down
2 changes: 1 addition & 1 deletion TLPhotoPicker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'TLPhotoPicker'
s.version = '1.4.4'
s.version = '1.4.5'
s.summary = 'multiple phassets picker for iOS lib. like facebook'

# This description is used to generate tags and improve search results.
Expand Down
13 changes: 13 additions & 0 deletions TLPhotoPicker/Classes/TLPhotosPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public struct TLPhotosPickerConfigure {
public var tapHereToChange = "Tap here to change"
public var cancelTitle = "Cancel"
public var doneTitle = "Done"
public var emptyMessage = "No albums"
public var emptyImage: UIImage? = nil
public var usedCameraButton = true
public var usedPrefetch = false
public var allowedLivePhotos = true
Expand Down Expand Up @@ -80,6 +82,9 @@ open class TLPhotosPickerViewController: UIViewController {
@IBOutlet open var doneButton: UIBarButtonItem!
@IBOutlet open var cancelButton: UIBarButtonItem!
@IBOutlet open var navigationBarTopConstraint: NSLayoutConstraint!
@IBOutlet open var emptyView: UIView!
@IBOutlet open var emptyImageView: UIImageView!
@IBOutlet open var emptyMessageLabel: UILabel!

public weak var delegate: TLPhotosPickerViewControllerDelegate? = nil
public var selectedAssets = [TLPHAsset]()
Expand Down Expand Up @@ -236,6 +241,9 @@ extension TLPhotosPickerViewController {
self.cancelButton.title = self.configure.cancelTitle
self.doneButton.title = self.configure.doneTitle
self.doneButton.setTitleTextAttributes([NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: UIFont.labelFontSize)], for: .normal)
self.emptyView.isHidden = true
self.emptyImageView.image = self.configure.emptyImage
self.emptyMessageLabel.text = self.configure.emptyMessage
self.albumPopView.tableView.delegate = self
self.albumPopView.tableView.dataSource = self
self.popArrowImageView.image = TLBundle.podBundleImage(named: "pop_arrow")
Expand Down Expand Up @@ -425,6 +433,11 @@ extension TLPhotosPickerViewController: TLPhotoLibraryDelegate {

func loadCompleteAllCollection(collections: [TLAssetsCollection]) {
self.collections = collections
let isEmpty = self.collections.count == 0
self.subTitleStackView.isHidden = isEmpty
self.emptyView.isHidden = !isEmpty
self.emptyImageView.isHidden = self.emptyImageView.image == nil
self.indicator.stopAnimating()
self.reloadTableView()
self.registerChangeObserver()
}
Expand Down
49 changes: 42 additions & 7 deletions TLPhotoPicker/Classes/TLPhotosPickerViewController.xib
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -17,6 +17,9 @@
<outlet property="collectionView" destination="4gR-Bn-quP" id="ZOF-qU-cpd"/>
<outlet property="customNavItem" destination="5CU-MZ-p1K" id="ih7-d3-nco"/>
<outlet property="doneButton" destination="daA-Ag-vVv" id="P53-fy-Sbh"/>
<outlet property="emptyImageView" destination="YDZ-o1-AXT" id="TVN-0v-aQc"/>
<outlet property="emptyMessageLabel" destination="7qj-q4-rHC" id="Bcp-Hu-lEY"/>
<outlet property="emptyView" destination="HPm-Vc-F86" id="4FT-XL-9ql"/>
<outlet property="indicator" destination="AEv-G6-dRI" id="coA-3n-07e"/>
<outlet property="navigationBarTopConstraint" destination="IKp-hS-tTy" id="MFH-eP-0tb"/>
<outlet property="popArrowImageView" destination="5zn-je-qLx" id="6k9-cH-vcU"/>
Expand Down Expand Up @@ -44,11 +47,11 @@
</connections>
</barButtonItem>
<view key="titleView" contentMode="scaleToFill" id="VAz-Py-dsa">
<rect key="frame" x="87.5" y="2" width="200" height="40"/>
<rect key="frame" x="87.5" y="0.0" width="200" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Ql8-7f-9Uk">
<rect key="frame" x="0.0" y="0.0" width="200" height="40"/>
<rect key="frame" x="0.0" y="0.0" width="200" height="44"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xuG-bc-Oq9">
<rect key="frame" x="79.5" y="0.0" width="41.5" height="19.5"/>
Expand All @@ -57,16 +60,16 @@
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="kgt-Cn-AXg">
<rect key="frame" x="78" y="19.5" width="44.5" height="20.5"/>
<rect key="frame" x="78" y="19.5" width="44.5" height="24.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="DON-iU-Cox">
<rect key="frame" x="0.0" y="3.5" width="29.5" height="13.5"/>
<rect key="frame" x="0.0" y="5.5" width="29.5" height="13.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="b7w-7R-rco">
<rect key="frame" x="34.5" y="5.5" width="10" height="10"/>
<rect key="frame" x="34.5" y="7.5" width="10" height="10"/>
<constraints>
<constraint firstAttribute="width" priority="999" constant="10" id="7bM-Da-Q8A"/>
<constraint firstAttribute="height" priority="999" constant="10" id="OHz-gp-CQp"/>
Expand Down Expand Up @@ -107,6 +110,34 @@
<outlet property="delegate" destination="-1" id="pjZ-sM-fyY"/>
</connections>
</collectionView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HPm-Vc-F86">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="gi6-Sw-3Zf">
<rect key="frame" x="137.5" y="239" width="100" height="125.5"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="YDZ-o1-AXT">
<rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
<constraints>
<constraint firstAttribute="width" priority="999" constant="100" id="VUj-VB-7Kr"/>
<constraint firstAttribute="height" priority="999" constant="100" id="jBo-WN-gZr"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7qj-q4-rHC">
<rect key="frame" x="29" y="105" width="42" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="gi6-Sw-3Zf" firstAttribute="centerX" secondItem="HPm-Vc-F86" secondAttribute="centerX" id="FpA-96-esN"/>
<constraint firstItem="gi6-Sw-3Zf" firstAttribute="centerY" secondItem="HPm-Vc-F86" secondAttribute="centerY" id="L0c-BG-65l"/>
</constraints>
</view>
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="AEv-G6-dRI">
<rect key="frame" x="177" y="323" width="20" height="20"/>
</activityIndicatorView>
Expand Down Expand Up @@ -164,16 +195,20 @@
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="HPm-Vc-F86" firstAttribute="bottom" secondItem="HLR-WT-D3I" secondAttribute="bottom" id="0AS-35-SWm"/>
<constraint firstItem="AEv-G6-dRI" firstAttribute="centerX" secondItem="Zyk-dI-msE" secondAttribute="centerX" id="44C-fd-MVc"/>
<constraint firstItem="X8O-Gg-slz" firstAttribute="leading" secondItem="Zyk-dI-msE" secondAttribute="leading" id="4Ud-fp-qD2"/>
<constraint firstItem="4gR-Bn-quP" firstAttribute="top" secondItem="X8O-Gg-slz" secondAttribute="bottom" id="CZx-xl-GLa"/>
<constraint firstItem="X8O-Gg-slz" firstAttribute="top" secondItem="HLR-WT-D3I" secondAttribute="top" id="IKp-hS-tTy"/>
<constraint firstItem="Jcn-hC-Umh" firstAttribute="top" secondItem="X8O-Gg-slz" secondAttribute="bottom" id="KdD-nT-6tf"/>
<constraint firstItem="HPm-Vc-F86" firstAttribute="leading" secondItem="HLR-WT-D3I" secondAttribute="leading" id="M3L-CU-HdQ"/>
<constraint firstAttribute="trailing" secondItem="4gR-Bn-quP" secondAttribute="trailing" id="M6b-2G-2m1"/>
<constraint firstAttribute="trailing" secondItem="Jcn-hC-Umh" secondAttribute="trailing" id="Njh-ZO-lnq"/>
<constraint firstAttribute="bottom" secondItem="Jcn-hC-Umh" secondAttribute="bottom" id="NxH-d8-b65"/>
<constraint firstItem="HPm-Vc-F86" firstAttribute="top" secondItem="X8O-Gg-slz" secondAttribute="bottom" id="YyG-QW-0ZP"/>
<constraint firstItem="AEv-G6-dRI" firstAttribute="centerY" secondItem="Zyk-dI-msE" secondAttribute="centerY" id="aLU-u9-ALA"/>
<constraint firstItem="Jcn-hC-Umh" firstAttribute="leading" secondItem="Zyk-dI-msE" secondAttribute="leading" id="aY7-Ml-cd3"/>
<constraint firstItem="HPm-Vc-F86" firstAttribute="trailing" secondItem="HLR-WT-D3I" secondAttribute="trailing" id="aoA-8G-xDA"/>
<constraint firstItem="4gR-Bn-quP" firstAttribute="leading" secondItem="Zyk-dI-msE" secondAttribute="leading" id="kb7-vy-yTu"/>
<constraint firstItem="4gR-Bn-quP" firstAttribute="bottom" secondItem="HLR-WT-D3I" secondAttribute="bottom" id="qqE-w2-Tsc"/>
<constraint firstAttribute="trailing" secondItem="X8O-Gg-slz" secondAttribute="trailing" id="yWV-L2-0f4"/>
Expand Down

0 comments on commit ec8979d

Please sign in to comment.