Merge pull request #80 from nohana/release/0.8.0

Release/0.8.0
This commit is contained in:
Kazushi Hara 2017-06-17 22:39:43 +09:00 committed by GitHub
commit cf3868fcaf
39 changed files with 177 additions and 139 deletions

View File

@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
@ -32,6 +42,16 @@
"filename" : "180.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",

View File

@ -29,6 +29,7 @@ class DemoListViewController: UITableViewController, NohanaImagePickerController
Cell(title: "Large thumbnail", selector: #selector(DemoListViewController.showLargeThumbnailPicker)),
Cell(title: "No toolbar", selector: #selector(DemoListViewController.showNoToolbarPicker)),
Cell(title: "Disable to pick assets", selector: #selector(DemoListViewController.showDisableToPickAssetsPicker)),
Cell(title: "Custom UI", selector: #selector(DemoListViewController.showCustomUIPicker)),
]
override func viewDidAppear(_ animated: Bool) {
@ -38,6 +39,10 @@ class DemoListViewController: UITableViewController, NohanaImagePickerController
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return cells.count
}
@ -60,8 +65,6 @@ class DemoListViewController: UITableViewController, NohanaImagePickerController
}
})
}
}
// MARK: - Photos
@ -123,6 +126,18 @@ class DemoListViewController: UITableViewController, NohanaImagePickerController
present(picker, animated: true, completion: nil)
}
@objc
func showCustomUIPicker() {
let picker = NohanaImagePickerController()
picker.delegate = self
picker.config.color.background = UIColor(red: 0xcc/0xff, green: 0xff/0xff, blue: 0xff/0xff, alpha: 1)
picker.config.color.separator = UIColor(red: 0x00/0xff, green: 0x66/0xff, blue: 0x66/0xff, alpha: 1)
picker.config.strings.albumListTitle = "🏞"
picker.config.image.droppedSmall = UIImage(named: "btn_select_m")
picker.config.image.pickedSmall = UIImage(named: "btn_selected_m")
present(picker, animated: true, completion: nil)
}
// MARK: - NohanaImagePickerControllerDelegate
func nohanaImagePickerDidCancel(_ picker: NohanaImagePickerController) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'NohanaImagePicker'
s.version = '0.7.1'
s.version = '0.8.0'
s.summary = 'A multiple image picker for iOS app.'
s.homepage = 'https://github.com/nohana/NohanaImagePicker'
s.license = { :type => 'Apache License v2', :file => 'LICENSE' }

View File

@ -7,7 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
F202573A1C7343D20069B33A /* ImageName.swift in Sources */ = {isa = PBXBuildFile; fileRef = F20257391C7343D20069B33A /* ImageName.swift */; };
3569CAA91EC1918E000C41C0 /* NohanaImagePicker.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3569CAA61EC1918E000C41C0 /* NohanaImagePicker.xcassets */; };
F202573C1C7418920069B33A /* PickedAssetList.swift in Sources */ = {isa = PBXBuildFile; fileRef = F202573B1C7418920069B33A /* PickedAssetList.swift */; };
F208E5541CD7370B00FFC9F6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F208E5531CD7370B00FFC9F6 /* AppDelegate.swift */; };
F208E5591CD7370B00FFC9F6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F208E5571CD7370B00FFC9F6 /* Main.storyboard */; };
@ -21,14 +21,13 @@
F218D7DE1C6C3A5B001FCED1 /* AlbumCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F218D7DD1C6C3A5B001FCED1 /* AlbumCell.swift */; };
F23554261C69D19C00796DCA /* NohanaImagePicker.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F23554251C69D19C00796DCA /* NohanaImagePicker.storyboard */; };
F23554281C69D5DB00796DCA /* NohanaImagePickerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F23554271C69D5DB00796DCA /* NohanaImagePickerController.swift */; };
F237249B1C6DCF96005D1E8A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F237249A1C6DCF96005D1E8A /* Images.xcassets */; };
F237249B1C6DCF96005D1E8A /* NohanaImagePicker.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F237249A1C6DCF96005D1E8A /* NohanaImagePicker.xcassets */; };
F23CC89E1CB745C800BCE443 /* ActivityIndicatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F23CC89D1CB745C800BCE443 /* ActivityIndicatable.swift */; };
F24EB6901C68AEED0002EC86 /* AlbumListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F24EB68F1C68AEED0002EC86 /* AlbumListViewController.swift */; };
F25C10C21C8ED9BF007453C3 /* MomentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F25C10C11C8ED9BF007453C3 /* MomentViewController.swift */; };
F25C69881CA23A0A005935D6 /* MomentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F25C69871CA23A0A005935D6 /* MomentCell.swift */; };
F25C69901CA27311005935D6 /* EmptyIndicatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F25C698F1CA27311005935D6 /* EmptyIndicatable.swift */; };
F25C69921CA28728005935D6 /* AlbumListEmptyIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F25C69911CA28728005935D6 /* AlbumListEmptyIndicator.swift */; };
F25C699B1CA2B79A005935D6 /* ColorConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = F25C699A1CA2B79A005935D6 /* ColorConfig.swift */; };
F26775DE1C701FA7002E786C /* ItemList.swift in Sources */ = {isa = PBXBuildFile; fileRef = F26775DD1C701FA7002E786C /* ItemList.swift */; };
F26775E11C7046C7002E786C /* ExpandingAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F26775E01C7046C7002E786C /* ExpandingAnimationController.swift */; };
F26775E51C70574F002E786C /* AnimatableNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F26775E41C70574F002E786C /* AnimatableNavigationController.swift */; };
@ -71,7 +70,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
F20257391C7343D20069B33A /* ImageName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageName.swift; sourceTree = "<group>"; };
3569CAA61EC1918E000C41C0 /* NohanaImagePicker.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = NohanaImagePicker.xcassets; sourceTree = "<group>"; };
3590F1F51EC1A79400F32E06 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/NohanaImagePicker.strings; sourceTree = "<group>"; };
F202573B1C7418920069B33A /* PickedAssetList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PickedAssetList.swift; sourceTree = "<group>"; };
F208E5511CD7370B00FFC9F6 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
F208E5531CD7370B00FFC9F6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@ -85,14 +85,13 @@
F218D7DD1C6C3A5B001FCED1 /* AlbumCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlbumCell.swift; sourceTree = "<group>"; };
F23554251C69D19C00796DCA /* NohanaImagePicker.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NohanaImagePicker.storyboard; sourceTree = "<group>"; };
F23554271C69D5DB00796DCA /* NohanaImagePickerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NohanaImagePickerController.swift; sourceTree = "<group>"; };
F237249A1C6DCF96005D1E8A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
F237249A1C6DCF96005D1E8A /* NohanaImagePicker.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = NohanaImagePicker.xcassets; sourceTree = "<group>"; };
F23CC89D1CB745C800BCE443 /* ActivityIndicatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivityIndicatable.swift; sourceTree = "<group>"; };
F24EB68F1C68AEED0002EC86 /* AlbumListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlbumListViewController.swift; sourceTree = "<group>"; };
F25C10C11C8ED9BF007453C3 /* MomentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MomentViewController.swift; sourceTree = "<group>"; };
F25C69871CA23A0A005935D6 /* MomentCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MomentCell.swift; sourceTree = "<group>"; };
F25C698F1CA27311005935D6 /* EmptyIndicatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmptyIndicatable.swift; sourceTree = "<group>"; };
F25C69911CA28728005935D6 /* AlbumListEmptyIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlbumListEmptyIndicator.swift; sourceTree = "<group>"; };
F25C699A1CA2B79A005935D6 /* ColorConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorConfig.swift; sourceTree = "<group>"; };
F26775DD1C701FA7002E786C /* ItemList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemList.swift; sourceTree = "<group>"; };
F26775E01C7046C7002E786C /* ExpandingAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExpandingAnimationController.swift; sourceTree = "<group>"; };
F26775E41C70574F002E786C /* AnimatableNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatableNavigationController.swift; sourceTree = "<group>"; };
@ -132,9 +131,18 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
3569CAA31EC1918E000C41C0 /* Resources */ = {
isa = PBXGroup;
children = (
3569CAA61EC1918E000C41C0 /* NohanaImagePicker.xcassets */,
);
path = Resources;
sourceTree = "<group>";
};
F208E5521CD7370B00FFC9F6 /* Demo */ = {
isa = PBXGroup;
children = (
3569CAA31EC1918E000C41C0 /* Resources */,
F208E5531CD7370B00FFC9F6 /* AppDelegate.swift */,
F208E5681CD738CD00FFC9F6 /* DemoListViewController.swift */,
F208E5571CD7370B00FFC9F6 /* Main.storyboard */,
@ -163,7 +171,7 @@
children = (
F23554251C69D19C00796DCA /* NohanaImagePicker.storyboard */,
F27029CD1C71C43A001647AB /* NohanaImagePicker.strings */,
F237249A1C6DCF96005D1E8A /* Images.xcassets */,
F237249A1C6DCF96005D1E8A /* NohanaImagePicker.xcassets */,
);
name = Resources;
sourceTree = "<group>";
@ -194,12 +202,10 @@
children = (
F26775DD1C701FA7002E786C /* ItemList.swift */,
F202573B1C7418920069B33A /* PickedAssetList.swift */,
F20257391C7343D20069B33A /* ImageName.swift */,
F26775E71C7073CD002E786C /* Size.swift */,
F2DA29761C7749D600B0A8E3 /* NotificationInfo.swift */,
F25C698F1CA27311005935D6 /* EmptyIndicatable.swift */,
F23CC89D1CB745C800BCE443 /* ActivityIndicatable.swift */,
F25C699A1CA2B79A005935D6 /* ColorConfig.swift */,
);
name = Common;
sourceTree = "<group>";
@ -328,6 +334,7 @@
en,
Base,
ja,
ru,
);
mainGroup = F2C08D6A1C68651900B00181;
productRefGroup = F2C08D751C68651900B00181 /* Products */;
@ -346,6 +353,7 @@
buildActionMask = 2147483647;
files = (
F208E55E1CD7370B00FFC9F6 /* LaunchScreen.storyboard in Resources */,
3569CAA91EC1918E000C41C0 /* NohanaImagePicker.xcassets in Resources */,
F208E55B1CD7370B00FFC9F6 /* Assets.xcassets in Resources */,
F208E5591CD7370B00FFC9F6 /* Main.storyboard in Resources */,
);
@ -357,7 +365,7 @@
files = (
F23554261C69D19C00796DCA /* NohanaImagePicker.storyboard in Resources */,
F27029CB1C71C43A001647AB /* NohanaImagePicker.strings in Resources */,
F237249B1C6DCF96005D1E8A /* Images.xcassets in Resources */,
F237249B1C6DCF96005D1E8A /* NohanaImagePicker.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -385,7 +393,6 @@
F25C10C21C8ED9BF007453C3 /* MomentViewController.swift in Sources */,
F25C69881CA23A0A005935D6 /* MomentCell.swift in Sources */,
F2FE1F781C901D9400FDBE7B /* MomentSectionHeaderView.swift in Sources */,
F202573A1C7343D20069B33A /* ImageName.swift in Sources */,
F23554281C69D5DB00796DCA /* NohanaImagePickerController.swift in Sources */,
F25C69921CA28728005935D6 /* AlbumListEmptyIndicator.swift in Sources */,
F2131F431C79615700797887 /* SwipeInteractionController.swift in Sources */,
@ -400,7 +407,6 @@
F2DF3B2B1C6CC4DB00C1C0E4 /* AssetDetailListViewController.swift in Sources */,
F218D7D61C6B3D22001FCED1 /* PhotoKitAlbumList.swift in Sources */,
F24EB6901C68AEED0002EC86 /* AlbumListViewController.swift in Sources */,
F25C699B1CA2B79A005935D6 /* ColorConfig.swift in Sources */,
F28F4AC31C6C49EE00B7D725 /* PhotoKitAssetList.swift in Sources */,
F26775EA1C71645A002E786C /* ContractingAnimationController.swift in Sources */,
);
@ -438,6 +444,7 @@
children = (
F27029CC1C71C43A001647AB /* en */,
F27029CF1C71C4FE001647AB /* ja */,
3590F1F51EC1A79400F32E06 /* ru */,
);
name = NohanaImagePicker.strings;
sourceTree = "<group>";

View File

@ -16,21 +16,21 @@
class AlbumListEmptyIndicator: UILabel {
init(message: String, description: String, frame: CGRect) {
init(message: String, description: String, frame: CGRect, config: NohanaImagePickerController.Config) {
super.init(frame: frame)
let centerStyle = NSMutableParagraphStyle()
centerStyle.alignment = NSTextAlignment.center
let messageAttributes = [
NSForegroundColorAttributeName : ColorConfig.emptyIndicator,
NSForegroundColorAttributeName : config.color.empty ?? UIColor(red: 0x88/0xff, green: 0x88/0xff, blue: 0x88/0xff, alpha: 1),
NSFontAttributeName : UIFont.systemFont(ofSize: 26),
NSParagraphStyleAttributeName : centerStyle
]
let messageText = NSAttributedString(string: message, attributes: messageAttributes)
let descriptionAttributes = [
NSForegroundColorAttributeName : ColorConfig.emptyIndicator,
NSForegroundColorAttributeName : config.color.empty ?? UIColor(red: 0x88/0xff, green: 0x88/0xff, blue: 0x88/0xff, alpha: 1),
NSFontAttributeName : UIFont.systemFont(ofSize: 14),
NSParagraphStyleAttributeName : centerStyle
]

View File

@ -41,13 +41,13 @@ class AlbumListViewController: UITableViewController, EmptyIndicatable, Activity
override func viewDidLoad() {
super.viewDidLoad()
if let nohanaImagePickerController = nohanaImagePickerController {
title = NSLocalizedString("albumlist.title", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: "")
view.backgroundColor = nohanaImagePickerController.config.color.background ?? .white
title = nohanaImagePickerController.config.strings.albumListTitle ?? NSLocalizedString("albumlist.title", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: "")
setUpToolbarItems()
navigationController?.setToolbarHidden(nohanaImagePickerController.toolbarHidden ,animated: false)
}
setUpEmptyIndicator()
setUpActivityIndicator()
self.view.backgroundColor = ColorConfig.backgroundColor
}
deinit {
@ -135,11 +135,12 @@ class AlbumListViewController: UITableViewController, EmptyIndicatable, Activity
switch sectionType {
case .moment:
guard let cell = tableView.dequeueReusableCell(withIdentifier: "MomentAlbumCell") as? AlbumCell else {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "MomentAlbumCell") as? MomentCell else {
fatalError("failed to dequeueReusableCellWithIdentifier(\"MomentAlbumCell\")")
}
if let nohanaImagePickerController = nohanaImagePickerController {
cell.titleLabel?.text = NSLocalizedString("albumlist.moment.title", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: "")
cell.config = nohanaImagePickerController.config
cell.titleLabel?.text = nohanaImagePickerController.config.strings.albumListMomentTitle ?? NSLocalizedString("albumlist.moment.title", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: "")
}
return cell
case .albums:
@ -220,9 +221,10 @@ class AlbumListViewController: UITableViewController, EmptyIndicatable, Activity
return
}
emptyIndicator = AlbumListEmptyIndicator(
message: NSLocalizedString("albumlist.empty.message", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
description: NSLocalizedString("albumlist.empty.description", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
frame: frame)
message: nohanaImagePickerController.config.strings.albumListEmptyMessage ?? NSLocalizedString("albumlist.empty.message", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
description: nohanaImagePickerController.config.strings.albumListEmptyDescription ?? NSLocalizedString("albumlist.empty.description", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
frame: frame,
config: nohanaImagePickerController.config)
}
func isEmpty() -> Bool {
@ -272,11 +274,11 @@ extension UIViewController {
return
}
if nohanaImagePickerController.maximumNumberOfSelection == 0 {
let title = String(format: NSLocalizedString("toolbar.title.nolimit", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
let title = String(format: nohanaImagePickerController.config.strings.toolbarTitleNoLimit ?? NSLocalizedString("toolbar.title.nolimit", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
nohanaImagePickerController.pickedAssetList.count)
infoButton.title = title
} else {
let title = String(format: NSLocalizedString("toolbar.title.haslimit", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
let title = String(format: nohanaImagePickerController.config.strings.toolbarTitleHasLimit ?? NSLocalizedString("toolbar.title.haslimit", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
nohanaImagePickerController.pickedAssetList.count,
nohanaImagePickerController.maximumNumberOfSelection)
infoButton.title = title

View File

@ -27,12 +27,11 @@ class AssetCell: UICollectionViewCell {
override func willMove(toSuperview newSuperview: UIView?) {
super.willMove(toSuperview: newSuperview)
if let nohanaImagePickerController = nohanaImagePickerController {
pickButton.setImage(
UIImage(named: ImageName.AssetCell.PickButton.SizeM.dropped, in: nohanaImagePickerController.assetBundle, compatibleWith: nil),
for: UIControlState())
pickButton.setImage(
UIImage(named: ImageName.AssetCell.PickButton.SizeM.picked, in: nohanaImagePickerController.assetBundle, compatibleWith: nil),
for: .selected)
let droppedImage: UIImage? = nohanaImagePickerController.config.image.droppedSmall ?? UIImage(named: "btn_select_m", in: nohanaImagePickerController.assetBundle, compatibleWith: nil)
let pickedImage: UIImage? = nohanaImagePickerController.config.image.pickedSmall ?? UIImage(named: "btn_selected_m", in: nohanaImagePickerController.assetBundle, compatibleWith: nil)
pickButton.setImage(droppedImage, for: UIControlState())
pickButton.setImage(pickedImage, for: .selected)
}
}

View File

@ -35,12 +35,11 @@ class AssetDetailListViewController: AssetListViewController {
override func viewDidLoad() {
super.viewDidLoad()
if let nohanaImagePickerController = nohanaImagePickerController {
pickButton.setImage(
UIImage(named: ImageName.AssetCell.PickButton.SizeL.dropped, in: nohanaImagePickerController.assetBundle, compatibleWith: nil),
for: UIControlState())
pickButton.setImage(
UIImage(named: ImageName.AssetCell.PickButton.SizeL.picked, in: nohanaImagePickerController.assetBundle, compatibleWith: nil),
for: .selected)
let droppedImage: UIImage? = nohanaImagePickerController.config.image.droppedLarge ?? UIImage(named: "btn_select_l", in: nohanaImagePickerController.assetBundle, compatibleWith: nil)
let pickedImage: UIImage? = nohanaImagePickerController.config.image.pickedLarge ?? UIImage(named: "btn_selected_l", in: nohanaImagePickerController.assetBundle, compatibleWith: nil)
pickButton.setImage(droppedImage, for: UIControlState())
pickButton.setImage(pickedImage, for: .selected)
}
}

View File

@ -24,10 +24,10 @@ class AssetListViewController: UICollectionViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = nohanaImagePickerController?.config.color.background ?? .white
updateTitle()
setUpToolbarItems()
addPickPhotoKitAssetNotificationObservers()
self.view.backgroundColor = ColorConfig.backgroundColor
}
var cellSize: CGSize {

View File

@ -1,30 +0,0 @@
/*
* Copyright (C) 2016 nohana, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
struct ImageName {
struct AssetCell {
struct PickButton {
struct SizeM {
static let picked = "btn_selected_m"
static let dropped = "btn_select_m"
}
struct SizeL {
static let picked = "btn_selected_l"
static let dropped = "btn_select_l"
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -17,11 +17,13 @@
import UIKit
class MomentCell: AlbumCell {
var config: NohanaImagePickerController.Config!
override func draw(_ rect: CGRect) {
super.draw(rect)
let lineWidth: CGFloat = 1 / UIScreen.main.scale
ColorConfig.AlbumList.momentCellSeparator.setFill()
let separatorColor: UIColor = config.color.separator ?? UIColor(red: 0xbb/0xff, green: 0xbb/0xff, blue: 0xbb/0xff, alpha: 1)
separatorColor.setFill()
UIRectFill(CGRect(x: 16, y: frame.size.height - lineWidth, width: frame.size.width, height:lineWidth))
}

View File

@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_0" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Album List View Controller-->
@ -13,10 +17,10 @@
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="Nh8-55-S0b">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="AlbumCell" rowHeight="82" id="HiQ-6b-xqZ" customClass="AlbumCell" customModule="NohanaImagePicker" customModuleProvider="target">
<rect key="frame" x="0.0" y="92" width="320" height="82"/>
<rect key="frame" x="0.0" y="28" width="320" height="82"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="HiQ-6b-xqZ" id="Nuf-ja-Ajg">
<rect key="frame" x="0.0" y="0.0" width="287" height="82"/>
@ -30,12 +34,9 @@
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Album Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YSz-MM-h6f">
<rect key="frame" x="100" y="33" width="187" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="X2y-hP-9aM"/>
</constraints>
<rect key="frame" x="100" y="31.5" width="187" height="19.5"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -47,7 +48,7 @@
<constraint firstAttribute="trailingMargin" secondItem="YSz-MM-h6f" secondAttribute="trailing" constant="-8" id="tee-FS-sAo"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="thumbnailImageView" destination="Igm-UH-WUI" id="RZo-Jd-deA"/>
<outlet property="titleLabel" destination="YSz-MM-h6f" id="bA5-m7-lwo"/>
@ -55,7 +56,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="MomentAlbumCell" rowHeight="52" id="URZ-ke-kYw" customClass="MomentCell" customModule="NohanaImagePicker" customModuleProvider="target">
<rect key="frame" x="0.0" y="174" width="320" height="52"/>
<rect key="frame" x="0.0" y="110" width="320" height="52"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="URZ-ke-kYw" id="ZzC-oj-tew">
<rect key="frame" x="0.0" y="0.0" width="287" height="52"/>
@ -67,7 +68,7 @@
<constraint firstAttribute="height" constant="16" id="tPC-2Q-2pd"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -77,7 +78,7 @@
<constraint firstItem="nzC-P1-sBf" firstAttribute="centerY" secondItem="ZzC-oj-tew" secondAttribute="centerY" id="SZH-em-zj3"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="titleLabel" destination="nzC-P1-sBf" id="XE1-Qw-Xid"/>
<segue destination="FOz-K3-QuR" kind="show" id="oPR-kG-SaF"/>
@ -110,7 +111,7 @@
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" id="cLH-x9-2VN">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="2" minimumInteritemSpacing="2" id="xXL-vg-bZb">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
@ -119,7 +120,7 @@
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="AssetCell" id="gNu-ad-t1d" customClass="AssetCell" customModule="NohanaImagePicker" customModuleProvider="target">
<rect key="frame" x="0.0" y="72" width="78" height="78"/>
<rect key="frame" x="0.0" y="8" width="78" height="78"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="78" height="78"/>
@ -130,7 +131,7 @@
</imageView>
<view hidden="YES" alpha="0.29999999999999999" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="MT5-kg-1gq">
<rect key="frame" x="0.0" y="0.0" width="78" height="78"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oDB-be-mWY">
<rect key="frame" x="34" y="0.0" width="44" height="44"/>
@ -138,13 +139,11 @@
<constraint firstAttribute="width" constant="44" id="7Yd-sj-A9c"/>
<constraint firstAttribute="height" constant="44" id="Biw-rC-p8x"/>
</constraints>
<state key="normal" image="btn_select_m"/>
<connections>
<action selector="didPushPickButton:" destination="gNu-ad-t1d" eventType="touchUpInside" id="gAj-yS-7xL"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="oDB-be-mWY" secondAttribute="trailing" constant="-8" id="0u6-oO-0PG"/>
@ -168,7 +167,7 @@
</collectionViewCell>
</cells>
<collectionReusableView key="sectionFooterView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="AssetListFooter" id="N6q-ob-hkI">
<rect key="frame" x="0.0" y="152" width="320" height="44"/>
<rect key="frame" x="0.0" y="88" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</collectionReusableView>
<connections>
@ -188,7 +187,7 @@
</collectionViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="1SX-Sl-Deo" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1156" y="267"/>
<point key="canvasLocation" x="1749" y="214"/>
</scene>
<!--Asset Detail List View Controller-->
<scene sceneID="jjo-0p-7dH">
@ -205,7 +204,7 @@
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="AssetDetailCell" id="Sux-7h-iE6" customClass="AssetDetailCell" customModule="NohanaImagePicker" customModuleProvider="target">
<rect key="frame" x="0.0" y="156" width="320" height="320"/>
<rect key="frame" x="0.0" y="92" width="320" height="320"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="320" height="320"/>
@ -234,7 +233,6 @@
</connections>
</scrollView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<gestureRecognizers/>
<constraints>
@ -261,7 +259,6 @@
<button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="c4C-Sf-Krj">
<rect key="frame" x="276" y="8" width="28" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" image="btn_select_l"/>
<connections>
<action selector="didPushPickButton:" destination="r7t-t8-AuE" eventType="touchUpInside" id="vWF-yZ-1NC"/>
</connections>
@ -276,7 +273,7 @@
</collectionViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="u84-ka-8a6" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1598" y="456"/>
<point key="canvasLocation" x="2741" y="449"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="RR9-zr-Qlw">
@ -296,7 +293,7 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="3iI-ph-cZF" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="259" y="219"/>
<point key="canvasLocation" x="-456" y="215"/>
</scene>
<!--Animatable Navigation Controller-->
<scene sceneID="Zpb-f1-dmj">
@ -314,7 +311,7 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Sfb-mw-QnO" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="259" y="882"/>
<point key="canvasLocation" x="-458" y="935"/>
</scene>
<!--Moment View Controller-->
<scene sceneID="kJ6-NP-kmc">
@ -323,7 +320,7 @@
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" id="J9r-MB-y52">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="2" minimumInteritemSpacing="2" id="smE-Ti-qUX">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="50" height="44"/>
@ -332,7 +329,7 @@
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="AssetCell" id="hn9-bM-eId" customClass="AssetCell" customModule="NohanaImagePicker" customModuleProvider="target">
<rect key="frame" x="0.0" y="110" width="78" height="78"/>
<rect key="frame" x="0.0" y="46" width="78" height="78"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="78" height="78"/>
@ -343,7 +340,7 @@
</imageView>
<view hidden="YES" alpha="0.30000001192092896" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SnZ-bd-Zia">
<rect key="frame" x="0.0" y="0.0" width="78" height="78"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vrt-tc-b54">
<rect key="frame" x="34" y="0.0" width="44" height="44"/>
@ -351,13 +348,11 @@
<constraint firstAttribute="width" constant="44" id="BX8-gP-86t"/>
<constraint firstAttribute="height" constant="44" id="RUG-gG-ieX"/>
</constraints>
<state key="normal" image="btn_select_m"/>
<connections>
<action selector="didPushPickButton:" destination="hn9-bM-eId" eventType="touchUpInside" id="g70-dv-o5C"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<constraints>
<constraint firstAttribute="bottomMargin" secondItem="SnZ-bd-Zia" secondAttribute="bottom" constant="-8" id="1hA-eS-4fw"/>
@ -381,18 +376,17 @@
</collectionViewCell>
</cells>
<collectionReusableView key="sectionHeaderView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="MomentHeader" id="BCa-t3-9XW" customClass="MomentSectionHeaderView" customModule="NohanaImagePicker" customModuleProvider="target">
<rect key="frame" x="0.0" y="64" width="320" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Date" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aNJ-Oh-VhZ">
<rect key="frame" x="12" y="11" width="120" height="21"/>
<rect key="frame" x="12" y="13" width="120" height="17"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="21" id="KSm-hH-VZX"/>
<constraint firstAttribute="width" constant="120" id="QzC-0j-DZA"/>
<constraint firstAttribute="height" constant="21" id="XMh-5E-eAL"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
@ -401,12 +395,9 @@
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Location" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Aa-PA-AHS">
<rect key="frame" x="132" y="12" width="176" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="QVr-qn-Rz7"/>
</constraints>
<rect key="frame" x="132" y="15.5" width="176" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -447,13 +438,9 @@
</collectionViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="A16-1a-z3b" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1156" y="914"/>
<point key="canvasLocation" x="1751" y="965"/>
</scene>
</scenes>
<resources>
<image name="btn_select_l" width="28" height="28"/>
<image name="btn_select_m" width="44" height="44"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="tQI-o9-h2w"/>
<segue reference="Bed-w3-B1Q"/>

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "icon_photosize_low_s@2x.png",
"filename" : "btn_select_m@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "icon_photosize_low_s@3x.png",
"filename" : "btn_select_m@3x.png",
"scale" : "3x"
}
],

View File

@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "icon_photosize_alert_s@2x.png",
"filename" : "btn_selected_m@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "icon_photosize_alert_s@3x.png",
"filename" : "btn_selected_m@3x.png",
"scale" : "3x"
}
],

View File

@ -39,7 +39,7 @@ public enum MediaType: Int {
open class NohanaImagePickerController: UIViewController {
open var maximumNumberOfSelection: Int = 21 // set 0 to set no limit
open var maximumNumberOfSelection: Int = 21 // set 0 to no limit
open var numberOfColumnsInPortrait: Int = 4
open var numberOfColumnsInLandscape: Int = 7
open weak var delegate: NohanaImagePickerControllerDelegate?
@ -49,6 +49,8 @@ open class NohanaImagePickerController: UIViewController {
open var canPickAsset = { (asset:Asset) -> Bool in
return true
}
open var config: Config = Config()
lazy var assetBundle:Bundle = {
let bundle = Bundle(for: type(of: self))
if let path = bundle.path(forResource: "NohanaImagePicker", ofType: "bundle") {
@ -136,3 +138,31 @@ open class NohanaImagePickerController: UIViewController {
}
}
extension NohanaImagePickerController {
public struct Config {
public struct Color {
public var background: UIColor?
public var empty: UIColor?
public var separator: UIColor?
}
public var color = Color()
public struct Image {
public var pickedSmall: UIImage?
public var pickedLarge: UIImage?
public var droppedSmall: UIImage?
public var droppedLarge: UIImage?
}
public var image = Image()
public struct Strings {
public var albumListTitle: String?
public var albumListMomentTitle: String?
public var albumListEmptyMessage: String?
public var albumListEmptyDescription: String?
public var toolbarTitleNoLimit: String?
public var toolbarTitleHasLimit: String?
}
public var strings = Strings()
}
}

View File

@ -14,11 +14,9 @@
* limitations under the License.
*/
public struct ColorConfig {
public static var backgroundColor = UIColor.white
public static var emptyIndicator = UIColor(red: 0x88/0xff, green: 0x88/0xff, blue: 0x88/0xff, alpha: 1)
public struct AlbumList {
public static var momentCellSeparator = UIColor(red: 0xbb/0xff, green: 0xbb/0xff, blue: 0xbb/0xff, alpha: 1)
}
}
"albumlist.title" = "Фотографии";
"albumlist.empty.message" = "Нет фотографий";
"albumlist.empty.description" = "Получить фото с камеры";
"albumlist.moment.title" = "Моменты";
"toolbar.title.nolimit" = "Выбрано: %ld";
"toolbar.title.haslimit" = "Выбрано: %ld / %ld";

View File

@ -11,15 +11,20 @@ NohanaImagePicker enables your app to pick images from multiple album, and the m
## Usage
```swift
import UIKit
import Photos
import NohanaImagePicker
class ViewController: UIViewController, NohanaImagePickerControllerDelegate {
class MyViewController: UIViewController {
let picker = NohanaImagePickerController()
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(true)
let picker = NohanaImagePickerController()
picker.delegate = self
present(picker, animated: true, completion: nil)
super.viewDidAppear(animated)
self.picker.delegate = self
present(self.picker, animated: true, completion: nil)
}
}
extension MyViewController: NohanaImagePickerControllerDelegate {
func nohanaImagePickerDidCancel(_ picker: NohanaImagePickerController) {
print("🐷Canceled🙅")
@ -30,7 +35,6 @@ class ViewController: UIViewController, NohanaImagePickerControllerDelegate {
print("🐷Completed🙆\n\tpickedAssets = \(pickedAssts)")
picker.dismiss(animated: true, completion: nil)
}
}
```
@ -59,9 +63,6 @@ picker.shouldShowEmptyAlbum = true
picker.canPickAsset = { (asset:Asset) -> Bool in
return false
}
// Color
ColorConfig.backgroundColor = UIColor.redColor()
```
## Requirements
@ -84,6 +85,8 @@ Use [Carthage](https://github.com/Carthage/Carthage).
Use [CocoaPods](https://cocoapods.org/).
- Try; ``pod try NohanaImagePicker``
- Add the followings to your Podfile:
```ruby