diff --git a/BSImagePicker.podspec b/BSImagePicker.podspec index 7362b7a2..b9aa124e 100644 --- a/BSImagePicker.podspec +++ b/BSImagePicker.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "BSImagePicker" - s.version = "2.0.0" + s.version = "2.1.0" s.summary = "BSImagePicker is a multiple image picker for iOS 8. UIImagePickerController replacement" s.description = <<-DESC A mix between the native iOS 8 gallery and facebooks image picker. Allows you to preview and select multiple images. diff --git a/Example/BSImagePicker/Images.xcassets/Contents.json b/Example/BSImagePicker/Images.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/Example/BSImagePicker/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/BSImagePicker/Images.xcassets/chat.imageset/Contents.json b/Example/BSImagePicker/Images.xcassets/chat.imageset/Contents.json new file mode 100644 index 00000000..cfa11b4b --- /dev/null +++ b/Example/BSImagePicker/Images.xcassets/chat.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "chat.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "chat@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "chat@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/BSImagePicker/Images.xcassets/chat.imageset/chat.png b/Example/BSImagePicker/Images.xcassets/chat.imageset/chat.png new file mode 100644 index 00000000..e59bf874 Binary files /dev/null and b/Example/BSImagePicker/Images.xcassets/chat.imageset/chat.png differ diff --git a/Example/BSImagePicker/Images.xcassets/chat.imageset/chat@2x.png b/Example/BSImagePicker/Images.xcassets/chat.imageset/chat@2x.png new file mode 100644 index 00000000..603d5794 Binary files /dev/null and b/Example/BSImagePicker/Images.xcassets/chat.imageset/chat@2x.png differ diff --git a/Example/BSImagePicker/Images.xcassets/chat.imageset/chat@3x.png b/Example/BSImagePicker/Images.xcassets/chat.imageset/chat@3x.png new file mode 100644 index 00000000..980a63a3 Binary files /dev/null and b/Example/BSImagePicker/Images.xcassets/chat.imageset/chat@3x.png differ diff --git a/Example/BSImagePicker/ViewController.swift b/Example/BSImagePicker/ViewController.swift index 69779fd9..8fb58ba4 100644 --- a/Example/BSImagePicker/ViewController.swift +++ b/Example/BSImagePicker/ViewController.swift @@ -45,6 +45,7 @@ class ViewController: UIViewController { @IBAction func showCustomImagePicker(sender: UIButton) { let vc = BSImagePickerViewController() vc.maxNumberOfSelections = 6 + vc.takePhotoIcon = UIImage(named: "chat") vc.albumButton.tintColor = UIColor.greenColor() vc.cancelButton.tintColor = UIColor.redColor() diff --git a/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/BSImagePicker.xcscheme b/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/BSImagePicker.xcscheme index 361fb76b..106e00bd 100644 --- a/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/BSImagePicker.xcscheme +++ b/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/BSImagePicker.xcscheme @@ -14,7 +14,7 @@ buildForArchiving = "YES"> diff --git a/Pod/Assets/CameraCell.xib b/Pod/Assets/CameraCell.xib index 6f59540a..50833600 100644 --- a/Pod/Assets/CameraCell.xib +++ b/Pod/Assets/CameraCell.xib @@ -1,8 +1,7 @@ - + - - + @@ -19,7 +18,7 @@ - + @@ -46,7 +45,4 @@ - - - diff --git a/Pod/Assets/PhotoCell.xib b/Pod/Assets/PhotoCell.xib index 4e6ed847..5a53201a 100644 --- a/Pod/Assets/PhotoCell.xib +++ b/Pod/Assets/PhotoCell.xib @@ -1,8 +1,7 @@ - + - - + @@ -16,13 +15,16 @@ + + + @@ -30,8 +32,10 @@ + + diff --git a/Pod/Classes/Controller/BSImagePickerViewController.swift b/Pod/Classes/Controller/BSImagePickerViewController.swift index 3c1c3a55..9633bc3a 100644 --- a/Pod/Classes/Controller/BSImagePickerViewController.swift +++ b/Pod/Classes/Controller/BSImagePickerViewController.swift @@ -215,6 +215,15 @@ public final class BSImagePickerViewController : UINavigationController, BSImage } } + public var takePhotoIcon: UIImage? { + get { + return settings.takePhotoIcon + } + set { + settings.takePhotoIcon = newValue + } + } + // MARK: Buttons /** Cancel button diff --git a/Pod/Classes/Model/CameraCollectionViewDataSource.swift b/Pod/Classes/Model/CameraCollectionViewDataSource.swift index 1f7eb83d..163ee339 100644 --- a/Pod/Classes/Model/CameraCollectionViewDataSource.swift +++ b/Pod/Classes/Model/CameraCollectionViewDataSource.swift @@ -46,7 +46,10 @@ final class CameraCollectionViewDataSource: NSObject, UICollectionViewDataSource } func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { - return collectionView.dequeueReusableCellWithReuseIdentifier(cameraCellIdentifier, forIndexPath: indexPath) + let cameraCell = collectionView.dequeueReusableCellWithReuseIdentifier(cameraCellIdentifier, forIndexPath: indexPath) as! CameraCell + cameraCell.takePhotoIcon = settings.takePhotoIcon + + return cameraCell } func registerCellIdentifiersForCollectionView(collectionView: UICollectionView?) { diff --git a/Pod/Classes/Model/Settings.swift b/Pod/Classes/Model/Settings.swift index a4b1f5f1..77c08276 100644 --- a/Pod/Classes/Model/Settings.swift +++ b/Pod/Classes/Model/Settings.swift @@ -55,4 +55,6 @@ final class Settings : BSImagePickerSettings { } var takePhotos: Bool = false + + var takePhotoIcon: UIImage? = UIImage(named: "add_photo", inBundle: BSImagePickerViewController.bundle, compatibleWithTraitCollection: nil) } \ No newline at end of file diff --git a/Pod/Classes/Protocol/BSImagePickerSettings.swift b/Pod/Classes/Protocol/BSImagePickerSettings.swift index 2b807c19..69f4ea93 100644 --- a/Pod/Classes/Protocol/BSImagePickerSettings.swift +++ b/Pod/Classes/Protocol/BSImagePickerSettings.swift @@ -65,4 +65,10 @@ public protocol BSImagePickerSettings { Toggle take photos */ var takePhotos: Bool { get set } + + /** + Icon to show in take photo cell. + If you use a black image tint color will be applied to it. + */ + var takePhotoIcon: UIImage? { get set } } \ No newline at end of file diff --git a/Pod/Classes/View/CameraCell.swift b/Pod/Classes/View/CameraCell.swift index e0f4e487..4566454e 100644 --- a/Pod/Classes/View/CameraCell.swift +++ b/Pod/Classes/View/CameraCell.swift @@ -14,6 +14,14 @@ import AVFoundation final class CameraCell: UICollectionViewCell { @IBOutlet weak var imageView: UIImageView! @IBOutlet weak var cameraBackground: UIView! + var takePhotoIcon: UIImage? { + didSet { + imageView.image = takePhotoIcon + + // Apply tint to image + imageView.image = imageView.image?.imageWithRenderingMode(.AlwaysTemplate) + } + } var session: AVCaptureSession? var captureLayer: AVCaptureVideoPreviewLayer? @@ -22,9 +30,6 @@ final class CameraCell: UICollectionViewCell { override func awakeFromNib() { super.awakeFromNib() - // Apply tint to image - imageView.image = imageView.image?.imageWithRenderingMode(.AlwaysTemplate) - // Don't trigger camera access for the background guard AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo) == .Authorized else { return diff --git a/README.md b/README.md index 70304482..3b344893 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ BSImagePicker is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: ```ruby -pod "BSImagePicker", "~> 2.0" +pod "BSImagePicker", "~> 2.1" ``` ## Author