Commit a4ab2318 authored by banchichen's avatar banchichen

优化demo页的UI,新增多个开关,方便大家调试

parent f2f2364d
No preview for this file type
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<scenes>
<!--View Controller-->
......@@ -18,33 +19,185 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4Ae-5T-gEc" userLabel="TopContentView">
<rect key="frame" x="0.0" y="0.0" width="320" height="120"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="300"/>
<subviews>
<button opaque="NO" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="r81-gA-Wag">
<rect key="frame" x="20" y="55" width="280" height="30"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="obE-hs-XLa" userLabel="View1">
<rect key="frame" x="0.0" y="20" width="320" height="44"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jpa-B9-8n6">
<rect key="frame" x="225" y="6" width="51" height="31"/>
<connections>
<action selector="showTakePhotoBtnSwitchClick:" destination="BYZ-38-t0r" eventType="valueChanged" id="t9n-F2-EH7"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="显示内部拍照按钮" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="R92-Zn-NWV">
<rect key="frame" x="0.0" y="0.0" width="200" height="44"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" secondItem="R92-Zn-NWV" secondAttribute="width" multiplier="1.6" id="IVp-cg-8lA"/>
<constraint firstAttribute="bottom" secondItem="R92-Zn-NWV" secondAttribute="bottom" id="JHg-JO-5wI"/>
<constraint firstItem="R92-Zn-NWV" firstAttribute="leading" secondItem="obE-hs-XLa" secondAttribute="leading" id="Pc1-Bk-dX3"/>
<constraint firstItem="R92-Zn-NWV" firstAttribute="top" secondItem="obE-hs-XLa" secondAttribute="top" id="YDn-4a-bHN"/>
<constraint firstItem="jpa-B9-8n6" firstAttribute="centerY" secondItem="R92-Zn-NWV" secondAttribute="centerY" id="rov-on-mH6"/>
<constraint firstItem="jpa-B9-8n6" firstAttribute="leading" secondItem="R92-Zn-NWV" secondAttribute="trailing" constant="25" id="uvO-AN-pkZ"/>
<constraint firstAttribute="height" constant="44" id="yCe-ZT-Cih"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wWK-ob-W4A" userLabel="View2">
<rect key="frame" x="0.0" y="64" width="320" height="44"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Rbt-bh-r0x">
<rect key="frame" x="225" y="6" width="51" height="31"/>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="照片按修改时间升序排列" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UL3-n3-Hmt">
<rect key="frame" x="0.0" y="0.0" width="200" height="44"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Rbt-bh-r0x" firstAttribute="leading" secondItem="UL3-n3-Hmt" secondAttribute="trailing" constant="25" id="0mm-dF-5zD"/>
<constraint firstItem="Rbt-bh-r0x" firstAttribute="centerY" secondItem="UL3-n3-Hmt" secondAttribute="centerY" id="7qk-as-Gtz"/>
<constraint firstItem="UL3-n3-Hmt" firstAttribute="leading" secondItem="wWK-ob-W4A" secondAttribute="leading" id="j3y-ew-hru"/>
<constraint firstAttribute="bottom" secondItem="UL3-n3-Hmt" secondAttribute="bottom" id="lz7-aN-jzL"/>
<constraint firstAttribute="width" secondItem="UL3-n3-Hmt" secondAttribute="width" multiplier="1.6" id="s4J-yX-fdQ"/>
<constraint firstItem="UL3-n3-Hmt" firstAttribute="top" secondItem="wWK-ob-W4A" secondAttribute="top" id="yK3-h7-qua"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kJv-DR-NlY" userLabel="View3">
<rect key="frame" x="0.0" y="108" width="320" height="44"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="a58-aK-ZB0">
<rect key="frame" x="225" y="6" width="51" height="31"/>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="允许选择视频" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xCu-D3-IZg">
<rect key="frame" x="0.0" y="0.0" width="200" height="44"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="a58-aK-ZB0" firstAttribute="centerY" secondItem="xCu-D3-IZg" secondAttribute="centerY" id="0LW-75-uhX"/>
<constraint firstItem="xCu-D3-IZg" firstAttribute="top" secondItem="kJv-DR-NlY" secondAttribute="top" id="FSc-yB-Wbd"/>
<constraint firstAttribute="width" secondItem="xCu-D3-IZg" secondAttribute="width" multiplier="1.6" id="V7n-27-ctN"/>
<constraint firstItem="a58-aK-ZB0" firstAttribute="leading" secondItem="xCu-D3-IZg" secondAttribute="trailing" constant="25" id="c1V-HY-Q8K"/>
<constraint firstAttribute="bottom" secondItem="xCu-D3-IZg" secondAttribute="bottom" id="oio-T4-A2T"/>
<constraint firstItem="xCu-D3-IZg" firstAttribute="leading" secondItem="kJv-DR-NlY" secondAttribute="leading" id="uud-mX-pCv"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Z20-6k-hhA" userLabel="View4">
<rect key="frame" x="0.0" y="152" width="320" height="44"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iRQ-aE-1KG">
<rect key="frame" x="225" y="6" width="51" height="31"/>
<connections>
<action selector="allowPickingImageSwitchClick:" destination="BYZ-38-t0r" eventType="valueChanged" id="MHy-72-YhW"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="允许选择照片" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vNN-OI-9z1">
<rect key="frame" x="0.0" y="0.0" width="200" height="44"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="vNN-OI-9z1" secondAttribute="bottom" id="28W-Fe-DfW"/>
<constraint firstAttribute="width" secondItem="vNN-OI-9z1" secondAttribute="width" multiplier="1.6" id="F3Y-4A-Jm2"/>
<constraint firstItem="vNN-OI-9z1" firstAttribute="top" secondItem="Z20-6k-hhA" secondAttribute="top" id="JoE-06-fOC"/>
<constraint firstItem="vNN-OI-9z1" firstAttribute="leading" secondItem="Z20-6k-hhA" secondAttribute="leading" id="VM2-GM-yPT"/>
<constraint firstItem="iRQ-aE-1KG" firstAttribute="centerY" secondItem="vNN-OI-9z1" secondAttribute="centerY" id="nqo-Va-2Ry"/>
<constraint firstItem="iRQ-aE-1KG" firstAttribute="leading" secondItem="vNN-OI-9z1" secondAttribute="trailing" constant="25" id="v1d-4U-ifH"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jKt-h1-BC7" userLabel="View5">
<rect key="frame" x="0.0" y="196" width="320" height="44"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4L3-Da-pcd">
<rect key="frame" x="225" y="6" width="51" height="31"/>
<connections>
<action selector="allowPickingOriginPhotoSwitchClick:" destination="BYZ-38-t0r" eventType="valueChanged" id="mdw-vb-h0y"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="允许选择照片原图" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7mi-Lf-2N5">
<rect key="frame" x="0.0" y="0.0" width="200" height="44"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="30" id="B5p-sB-c5y"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="127" id="KAp-UH-6ZM"/>
<constraint firstAttribute="height" constant="30" id="kdh-Nr-oix"/>
<constraint firstItem="7mi-Lf-2N5" firstAttribute="top" secondItem="jKt-h1-BC7" secondAttribute="top" id="5f4-rF-B8W"/>
<constraint firstAttribute="width" secondItem="7mi-Lf-2N5" secondAttribute="width" multiplier="1.6" id="YDT-2P-yoV"/>
<constraint firstAttribute="bottom" secondItem="7mi-Lf-2N5" secondAttribute="bottom" id="f6A-bg-lSV"/>
<constraint firstItem="7mi-Lf-2N5" firstAttribute="leading" secondItem="jKt-h1-BC7" secondAttribute="leading" id="fw6-za-7xk"/>
<constraint firstItem="4L3-Da-pcd" firstAttribute="leading" secondItem="7mi-Lf-2N5" secondAttribute="trailing" constant="25" id="igx-XM-YGc"/>
<constraint firstItem="4L3-Da-pcd" firstAttribute="centerY" secondItem="7mi-Lf-2N5" secondAttribute="centerY" id="mWI-LI-dxQ"/>
</constraints>
<state key="normal" title="pick multi-photos"/>
<variation key="default">
<mask key="constraints">
<exclude reference="B5p-sB-c5y"/>
<exclude reference="KAp-UH-6ZM"/>
</mask>
</variation>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Qrr-87-KzM" userLabel="View6">
<rect key="frame" x="0.0" y="240" width="320" height="44"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="uHt-bT-lBZ">
<rect key="frame" x="225" y="6" width="51" height="31"/>
<connections>
<action selector="pickPhotoButtonClick:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Y3s-qn-oVG"/>
<action selector="showSheetSwitchClick:" destination="BYZ-38-t0r" eventType="valueChanged" id="sRv-xW-VSh"/>
</connections>
</button>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="把拍照按钮放在外面(未实现)" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jop-5R-ioj">
<rect key="frame" x="0.0" y="0.0" width="200" height="44"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.1715644113149847" green="0.94983992737003053" blue="0.50998662079510704" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="r81-gA-Wag" firstAttribute="top" secondItem="4Ae-5T-gEc" secondAttribute="top" constant="55" id="8mQ-5b-cnI"/>
<constraint firstAttribute="trailing" secondItem="r81-gA-Wag" secondAttribute="trailing" constant="20" id="QBT-qQ-Z2n"/>
<constraint firstItem="r81-gA-Wag" firstAttribute="leading" secondItem="4Ae-5T-gEc" secondAttribute="leading" constant="20" id="o2q-G0-PT5"/>
<constraint firstAttribute="height" constant="120" id="oAh-GJ-wLO"/>
<constraint firstItem="uHt-bT-lBZ" firstAttribute="leading" secondItem="jop-5R-ioj" secondAttribute="trailing" constant="25" id="5AQ-Ja-z2q"/>
<constraint firstAttribute="width" secondItem="jop-5R-ioj" secondAttribute="width" multiplier="1.6" id="6xl-zw-Cjf"/>
<constraint firstItem="jop-5R-ioj" firstAttribute="leading" secondItem="Qrr-87-KzM" secondAttribute="leading" id="ImU-dz-vvZ"/>
<constraint firstItem="uHt-bT-lBZ" firstAttribute="centerY" secondItem="jop-5R-ioj" secondAttribute="centerY" id="Q3i-03-WRr"/>
<constraint firstAttribute="bottom" secondItem="jop-5R-ioj" secondAttribute="bottom" id="WfS-JG-dr7"/>
<constraint firstItem="jop-5R-ioj" firstAttribute="top" secondItem="Qrr-87-KzM" secondAttribute="top" id="cA9-Cn-RpW"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="kJv-DR-NlY" firstAttribute="trailing" secondItem="wWK-ob-W4A" secondAttribute="trailing" id="1Yc-Fh-F1b"/>
<constraint firstItem="Qrr-87-KzM" firstAttribute="height" secondItem="jKt-h1-BC7" secondAttribute="height" id="3VF-b1-JSk"/>
<constraint firstItem="Z20-6k-hhA" firstAttribute="top" secondItem="kJv-DR-NlY" secondAttribute="bottom" id="4bL-zf-CCY"/>
<constraint firstItem="jKt-h1-BC7" firstAttribute="leading" secondItem="Z20-6k-hhA" secondAttribute="leading" id="5iC-le-TRg"/>
<constraint firstItem="Z20-6k-hhA" firstAttribute="trailing" secondItem="kJv-DR-NlY" secondAttribute="trailing" id="B4j-46-NPE"/>
<constraint firstItem="Qrr-87-KzM" firstAttribute="top" secondItem="jKt-h1-BC7" secondAttribute="bottom" id="D1Q-he-g4z"/>
<constraint firstAttribute="trailing" secondItem="obE-hs-XLa" secondAttribute="trailing" id="EMG-rP-KC3"/>
<constraint firstItem="wWK-ob-W4A" firstAttribute="height" secondItem="obE-hs-XLa" secondAttribute="height" id="OB1-PB-iQ9"/>
<constraint firstItem="Qrr-87-KzM" firstAttribute="trailing" secondItem="jKt-h1-BC7" secondAttribute="trailing" id="Oqu-jg-5a1"/>
<constraint firstItem="kJv-DR-NlY" firstAttribute="height" secondItem="wWK-ob-W4A" secondAttribute="height" id="URo-7q-6a8"/>
<constraint firstItem="kJv-DR-NlY" firstAttribute="leading" secondItem="wWK-ob-W4A" secondAttribute="leading" id="VSK-ph-uf4"/>
<constraint firstItem="wWK-ob-W4A" firstAttribute="trailing" secondItem="obE-hs-XLa" secondAttribute="trailing" id="W0D-WF-lhX"/>
<constraint firstItem="jKt-h1-BC7" firstAttribute="height" secondItem="Z20-6k-hhA" secondAttribute="height" id="ZcE-FZ-GW0"/>
<constraint firstItem="jKt-h1-BC7" firstAttribute="trailing" secondItem="Z20-6k-hhA" secondAttribute="trailing" id="c1N-P3-koK"/>
<constraint firstItem="obE-hs-XLa" firstAttribute="leading" secondItem="4Ae-5T-gEc" secondAttribute="leading" id="cSX-ku-9BL"/>
<constraint firstItem="wWK-ob-W4A" firstAttribute="leading" secondItem="obE-hs-XLa" secondAttribute="leading" id="djA-HO-MIW"/>
<constraint firstItem="obE-hs-XLa" firstAttribute="top" secondItem="4Ae-5T-gEc" secondAttribute="top" constant="20" id="icC-xS-GCo"/>
<constraint firstAttribute="height" constant="300" id="oAh-GJ-wLO"/>
<constraint firstItem="Qrr-87-KzM" firstAttribute="leading" secondItem="jKt-h1-BC7" secondAttribute="leading" id="olF-L6-ImN"/>
<constraint firstItem="jKt-h1-BC7" firstAttribute="top" secondItem="Z20-6k-hhA" secondAttribute="bottom" id="pH1-qa-EF2"/>
<constraint firstItem="Z20-6k-hhA" firstAttribute="leading" secondItem="kJv-DR-NlY" secondAttribute="leading" id="tDS-WS-osv"/>
<constraint firstItem="Z20-6k-hhA" firstAttribute="height" secondItem="kJv-DR-NlY" secondAttribute="height" id="vaX-20-bUE"/>
<constraint firstItem="kJv-DR-NlY" firstAttribute="top" secondItem="wWK-ob-W4A" secondAttribute="bottom" id="wqu-ns-MDY"/>
<constraint firstItem="wWK-ob-W4A" firstAttribute="top" secondItem="obE-hs-XLa" secondAttribute="bottom" id="ykH-od-wZK"/>
</constraints>
</view>
</subviews>
......@@ -56,9 +209,18 @@
</constraints>
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<connections>
<outlet property="allowPickingImageSwitch" destination="iRQ-aE-1KG" id="V7a-u6-cLv"/>
<outlet property="allowPickingOriginalPhotoSwitch" destination="4L3-Da-pcd" id="KFm-Zl-dpD"/>
<outlet property="allowPickingVideoSwitch" destination="a58-aK-ZB0" id="9Ti-hW-QRj"/>
<outlet property="showSheetSwitch" destination="uHt-bT-lBZ" id="NxK-wM-ivE"/>
<outlet property="showTakePhotoBtnSwitch" destination="jpa-B9-8n6" id="lh8-2O-IWS"/>
<outlet property="sortAscendingSwitch" destination="Rbt-bh-r0x" id="WEA-Vq-uSg"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="368" y="318"/>
</scene>
</scenes>
</document>
......@@ -67,7 +67,7 @@ static CGSize AssetGridThumbnailSize;
self.view.backgroundColor = [UIColor whiteColor];
self.navigationItem.title = _model.name;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(cancel)];
_showTakePhotoBtn = ([_model.name isEqualToString:@"相机胶卷"] || [_model.name isEqualToString:@"Camera Roll"] || [_model.name isEqualToString:@"所有照片"] || [_model.name isEqualToString:@"All Photos"]);
_showTakePhotoBtn = (([_model.name isEqualToString:@"相机胶卷"] || [_model.name isEqualToString:@"Camera Roll"] || [_model.name isEqualToString:@"所有照片"] || [_model.name isEqualToString:@"All Photos"]) && tzImagePickerVc.allowTakePicture);
if (!tzImagePickerVc.sortAscendingByModificationDate && _isFirstAppear && iOS8Later) {
[[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage completion:^(TZAlbumModel *model) {
_model = model;
......@@ -75,7 +75,7 @@ static CGSize AssetGridThumbnailSize;
[self initSubviews];
}];
} else {
if (_showTakePhotoBtn || !iOS8Later) {
if (_showTakePhotoBtn || !iOS8Later || _isFirstAppear) {
[[TZImageManager manager] getAssetsFromFetchResult:_model.result allowPickingVideo:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage completion:^(NSArray<TZAssetModel *> *models) {
_models = [NSMutableArray arrayWithArray:models];
[self initSubviews];
......
......@@ -25,6 +25,13 @@
LxGridViewFlowLayout *_layout;
}
@property (nonatomic, strong) UICollectionView *collectionView;
// 6个设置开关
@property (weak, nonatomic) IBOutlet UISwitch *showTakePhotoBtnSwitch; ///< 在内部显示拍照按钮
@property (weak, nonatomic) IBOutlet UISwitch *sortAscendingSwitch; ///< 照片排列按修改时间升序
@property (weak, nonatomic) IBOutlet UISwitch *allowPickingVideoSwitch; ///< 允许选择视频
@property (weak, nonatomic) IBOutlet UISwitch *allowPickingImageSwitch; ///< 允许选择图片
@property (weak, nonatomic) IBOutlet UISwitch *allowPickingOriginalPhotoSwitch; ///< 允许选择原图
@property (weak, nonatomic) IBOutlet UISwitch *showSheetSwitch; ///< 显示一个sheet,把拍照按钮放在外面
@end
@implementation ViewController
......@@ -44,11 +51,11 @@
_layout.itemSize = CGSizeMake(_itemWH, _itemWH);
_layout.minimumInteritemSpacing = _margin;
_layout.minimumLineSpacing = _margin;
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(_margin, 120, self.view.tz_width - 2 * _margin, 400) collectionViewLayout:_layout];
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 300, self.view.tz_width, self.view.tz_height - 300) collectionViewLayout:_layout];
CGFloat rgb = 244 / 255.0;
_collectionView.alwaysBounceVertical = YES;
_collectionView.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];
_collectionView.contentInset = UIEdgeInsetsMake(4, 0, 0, 2);
_collectionView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, 0, -2);
_collectionView.contentInset = UIEdgeInsetsMake(4, 4, 4, 4);
_collectionView.dataSource = self;
_collectionView.delegate = self;
[self.view addSubview:_collectionView];
......@@ -77,7 +84,7 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == _selectedPhotos.count) {
[self pickPhotoButtonClick:nil];
[self pushImagePickerController];
} else { // preview photos / 预览照片
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedPhotos index:indexPath.row];
imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto;
......@@ -104,6 +111,41 @@
}
}
- (void)pushImagePickerController {
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:self];
#pragma mark - 四类个性化设置,这些参数都可以不传,此时会走默认设置
imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto;
// 1.如果你需要将拍照按钮放在外面,不要传这个参数
imagePickerVc.selectedAssets = _selectedAssets; // optional, 可选的
imagePickerVc.allowTakePicture = self.showTakePhotoBtnSwitch.isOn; // 在内部显示拍照按钮
// 2. Set the appearance
// 2. 在这里设置imagePickerVc的外观
// imagePickerVc.navigationBar.barTintColor = [UIColor greenColor];
// imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor];
// imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor];
// 3. Set allow picking video & photo & originalPhoto or not
// 3. 设置是否可以选择视频/图片/原图
imagePickerVc.allowPickingVideo = self.allowPickingVideoSwitch.isOn;
imagePickerVc.allowPickingImage = self.allowPickingImageSwitch.isOn;
imagePickerVc.allowPickingOriginalPhoto = self.allowPickingOriginalPhotoSwitch.isOn;
// 4. 照片排列按修改时间升序
imagePickerVc.sortAscendingByModificationDate = self.sortAscendingSwitch.isOn;
#pragma mark - 到这里为止
// You can get the photos by block, the same as by delegate.
// 你可以通过block或者代理,来得到用户选择的照片.
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
}];
[self presentViewController:imagePickerVc animated:YES completion:nil];
}
#pragma mark Click Event
- (void)deleteBtnClik:(UIButton *)sender {
......@@ -119,35 +161,29 @@
}];
}
- (IBAction)pickPhotoButtonClick:(UIButton *)sender {
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:self];
imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto;
// tip:如果你需要将拍照放在外面,不要传这个参数
imagePickerVc.selectedAssets = _selectedAssets; // optional, 可选的
// imagePickerVc.allowTakePicture = NO; // 隐藏拍照按钮
// You can get the photos by block, the same as by delegate.
// 你可以通过block或者代理,来得到用户选择的照片.
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
}];
// Set the appearance
// 在这里设置imagePickerVc的外观
// imagePickerVc.navigationBar.barTintColor = [UIColor greenColor];
// imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor];
// imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor];
- (IBAction)showTakePhotoBtnSwitchClick:(UISwitch *)sender {
if (sender.isOn) {
[_showSheetSwitch setOn:NO animated:YES];
[_allowPickingImageSwitch setOn:YES animated:YES];
}
}
// Set allow picking video & photo & originalPhoto or not
// 设置是否可以选择视频/图片/原图
// imagePickerVc.allowPickingVideo = NO;
// imagePickerVc.allowPickingImage = NO;
// imagePickerVc.allowPickingOriginalPhoto = NO;
- (IBAction)showSheetSwitchClick:(UISwitch *)sender {
if (sender.isOn) {
[_showTakePhotoBtnSwitch setOn:NO animated:YES];
}
}
imagePickerVc.sortAscendingByModificationDate = NO;
- (IBAction)allowPickingOriginPhotoSwitchClick:(UISwitch *)sender {
if (sender.isOn) {
[_allowPickingImageSwitch setOn:YES animated:YES];
}
}
[self presentViewController:imagePickerVc animated:YES completion:nil];
- (IBAction)allowPickingImageSwitchClick:(UISwitch *)sender {
if (!sender.isOn) {
[_allowPickingOriginalPhotoSwitch setOn:NO animated:YES];
}
}
#pragma mark TZImagePickerControllerDelegate
......@@ -158,8 +194,14 @@
// NSLog(@"cancel");
}
/// User finish picking photo,if assets are not empty, user picking original photo.
/// 用户选择好了图片,如果assets非空,则用户选择了原图。
// The picker should dismiss itself; when it dismissed these handle will be called.
// If isOriginalPhoto is YES, user picked the original photo.
// You can get original photo with asset, by the method [[TZImageManager manager] getOriginalPhotoWithAsset:completion:].
// The UIImage Object in photos default width is 828px, you can set it by photoWidth property.
// 这个照片选择器会自己dismiss,当选择器dismiss的时候,会执行下面的代理方法
// 如果isSelectOriginalPhoto为YES,表明用户选择了原图
// 你可以通过一个asset获得原图,通过这个方法:[[TZImageManager manager] getOriginalPhotoWithAsset:completion:]
// photos数组里的UIImage对象,默认是828像素宽,你可以通过设置photoWidth属性的值来改变它
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto {
_selectedPhotos = [NSMutableArray arrayWithArray:photos];
_selectedAssets = [NSMutableArray arrayWithArray:assets];
......@@ -169,8 +211,10 @@
_collectionView.contentSize = CGSizeMake(0, ((_selectedPhotos.count + 2) / 3 ) * (_margin + _itemWH));
}
/// User finish picking video,
/// 用户选择好了视频
// If user picking a video, this callback will be called.
// If system version > iOS8,asset is kind of PHAsset class, else is ALAsset class.
// 如果用户选择了一个视频,下面的handle会被执行
// 如果系统版本大于iOS8,asset是PHAsset类的对象,否则是ALAsset类的对象
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingVideo:(UIImage *)coverImage sourceAssets:(id)asset {
_selectedPhotos = [NSMutableArray arrayWithArray:@[coverImage]];
_selectedAssets = [NSMutableArray arrayWithArray:@[asset]];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment