From a75ccb8dd49a6957d8bd7287880fba222f21007c Mon Sep 17 00:00:00 2001 From: Joakim Gyllstrom Date: Sun, 6 Dec 2015 11:31:07 +0100 Subject: [PATCH 1/3] Added photo icon to settings --- .../Images.xcassets/Contents.json | 6 +++++ .../chat.imageset/Contents.json | 23 ++++++++++++++++++ .../Images.xcassets/chat.imageset/chat.png | Bin 0 -> 654 bytes .../Images.xcassets/chat.imageset/chat@2x.png | Bin 0 -> 1309 bytes .../Images.xcassets/chat.imageset/chat@3x.png | Bin 0 -> 2077 bytes Example/BSImagePicker/ViewController.swift | 1 + 6 files changed, 30 insertions(+) create mode 100644 Example/BSImagePicker/Images.xcassets/Contents.json create mode 100644 Example/BSImagePicker/Images.xcassets/chat.imageset/Contents.json create mode 100644 Example/BSImagePicker/Images.xcassets/chat.imageset/chat.png create mode 100644 Example/BSImagePicker/Images.xcassets/chat.imageset/chat@2x.png create mode 100644 Example/BSImagePicker/Images.xcassets/chat.imageset/chat@3x.png 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 0000000000000000000000000000000000000000..e59bf874b7eeb38c3ac6520922fafed8a2515fa8 GIT binary patch literal 654 zcmV;90&)F`P)Px%NJ&INR9FecmQ6?$VI0P1&99_RN_G%7q9XEQppiE(5z$HT=COn4=oEAax^%Fh zF50C-D0qqpA_NtQAc{TY2N)6Ff{G3c8bn|Ad)D3M-En8$|GTr|1JCaJ@qEnAurrg3 zZ0JNb0=lca*hCg8@9K(Gd{(w71ZkIjs2BQVXEf`W5KQMWfp)3=+ zQO(16P@{8YDKiy4?0$remL&OpwQO+wc8+jp7PC1s^)Wqp8;ZX^VID*bsT-2$F zpTc_i`Fe{9YiAPH-Q`wIK11ITK6YIxV+HEo?92P0jAesRK{sF;a%|2(U#a#N6?E4q zmf@xhb#REaC(u$V&21Q6fL4Qa)36Oz(8b_649V!PnAZZ0uh93xJS+rySI}26$|&TB zrPX`YuLgXV@zmfMv(WNTy)MZf=#Re&L&L24O|lbT08g;_Z6C_Nlj*&&oJFK}Wa}^S z={CqZ2TjleK=0H4pf5OWe-^(kVK63eqy;DK>9IEy+~yc`8+-?o3bd}XqHDMSuS4&( zL}S7Ls^8Ep*WK*XNP)00001b5ch_0Itp) z=>Px(*GWV{RCod9np=ofRUF38sN-cy6E78X@gXm$Xqog9*h5y-OF?8HVxZ8V4}uD! zf(X--M))8GQHDwO&;=5FXvznPO3)W0HN4^wC=IA6GnG(k-|ukNVV~{3uD#Zov$ucv zX79cBTHpWs_GPVg)}F4KznCWKCBiepEMcbbi11(o+SG;{7}WNHa9;RT_(`}bbbMfL zhj3cBBiywFZQ+0m&W?)FQnOO{U9dHn)(&oRkZZ(Zlrk?D&IoCOU7aTvImzADcvIO< z39gLfGAsL~Eg-W4J9C(oWx^)w(l#UXA}Lky&#y(2Vw6Fz)^LORy7W>saXz_Sf9&N8&R6Axn9}2uXi-Z-zF(Ilh zW&FNH(9^=RLa)FQPh5SQauyHjF++cC2;$lxK5m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G@ZHES5u>*Rd#w^X??dF_qe zAST}nz6g|-$1lp|MsL)O5aG$QEVsyAKzdZH2pA=JZ&SqZ3n6W-vcCT#ac2E=p=_eq z7NrZwZ_8Om%ph7JjiE#9TA3u?a`C&Ykjh3#vt-t{k-shC#8jQ-&)*`ld(uZFulxwdaGl*{*qK|2`p1}}!w!m0O)L8w~Q07u-gxoE(3y2;zCPEv^Tnmku z3{^f8Q8g-j*cu^duW3>m%6zEN2+B|<|KWfMQEcSlP2>FaMQ9Y=CEO-3 zIqG~3g*Y_4%~OV}8$L@95~P3qhA`LzE)7p%m@+)4k+S>`r$GQYTsQ|*00000NkvXX Hu0mjf&H4Lq literal 0 HcmV?d00001 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() From 720888cc5c9224d8feeae0f24b548543a1d875aa Mon Sep 17 00:00:00 2001 From: Joakim Gyllstrom Date: Sun, 6 Dec 2015 11:35:26 +0100 Subject: [PATCH 2/3] Pod upate --- .../xcshareddata/xcschemes/BSImagePicker.xcscheme | 2 +- Pod/Assets/CameraCell.xib | 10 +++------- Pod/Assets/PhotoCell.xib | 10 +++++++--- .../Controller/BSImagePickerViewController.swift | 9 +++++++++ .../Model/CameraCollectionViewDataSource.swift | 5 ++++- Pod/Classes/Model/Settings.swift | 2 ++ Pod/Classes/Protocol/BSImagePickerSettings.swift | 6 ++++++ Pod/Classes/View/CameraCell.swift | 11 ++++++++--- 8 files changed, 40 insertions(+), 15 deletions(-) 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 From 7de4304c2fe542df4fd9c064b3f0cde0406bcca0 Mon Sep 17 00:00:00 2001 From: Joakim Gyllstrom Date: Sun, 6 Dec 2015 11:36:53 +0100 Subject: [PATCH 3/3] Bumped podspec and readme to 2.1 --- BSImagePicker.podspec | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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