├── ImagePicker.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── ImagePicker.xccheckout │ └── xcuserdata │ │ └── seungbocho.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── seungbocho.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── ImagePicker.xcscheme │ └── xcschememanagement.plist ├── ImagePicker ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── Main.storyboard ├── DoImagePicker │ ├── AssetHelper.h │ ├── AssetHelper.m │ ├── DoAlbumCell.h │ ├── DoAlbumCell.m │ ├── DoAlbumCell.xib │ ├── DoImagePickerController.h │ ├── DoImagePickerController.m │ ├── DoImagePickerController.xib │ ├── DoPhotoCell.h │ ├── DoPhotoCell.m │ └── DoPhotoCell.xib ├── ImagePicker-Info.plist ├── ImagePicker-Prefix.pch ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── ViewController.h ├── ViewController.m ├── en.lproj │ └── InfoPlist.strings └── main.m ├── ImagePickerTests ├── ImagePickerTests-Info.plist ├── ImagePickerTests.m └── en.lproj │ └── InfoPlist.strings ├── LICENSE ├── README.md ├── Resources └── Images │ ├── check.png │ ├── check@2x.png │ ├── close.png │ ├── close@2x.png │ ├── down.png │ ├── down@2x.png │ ├── line@2x.png │ ├── show.png │ ├── show@2x.png │ ├── up.png │ └── up@2x.png ├── p1.jpg ├── p2.jpg ├── p3.jpg └── p4.jpg /ImagePicker.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 731D67CA18A087A5002BAEF6 /* line@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 731D67C918A087A5002BAEF6 /* line@2x.png */; }; 11 | 731D67CE18A0D066002BAEF6 /* show.png in Resources */ = {isa = PBXBuildFile; fileRef = 731D67CC18A0D066002BAEF6 /* show.png */; }; 12 | 731D67CF18A0D066002BAEF6 /* show@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 731D67CD18A0D066002BAEF6 /* show@2x.png */; }; 13 | 73238CEB1890AAC60047DDA0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73238CEA1890AAC60047DDA0 /* Foundation.framework */; }; 14 | 73238CED1890AAC60047DDA0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73238CEC1890AAC60047DDA0 /* CoreGraphics.framework */; }; 15 | 73238CEF1890AAC60047DDA0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73238CEE1890AAC60047DDA0 /* UIKit.framework */; }; 16 | 73238CF51890AAC60047DDA0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 73238CF31890AAC60047DDA0 /* InfoPlist.strings */; }; 17 | 73238CF71890AAC60047DDA0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 73238CF61890AAC60047DDA0 /* main.m */; }; 18 | 73238CFB1890AAC60047DDA0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 73238CFA1890AAC60047DDA0 /* AppDelegate.m */; }; 19 | 73238CFE1890AAC60047DDA0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 73238CFC1890AAC60047DDA0 /* Main.storyboard */; }; 20 | 73238D011890AAC60047DDA0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 73238D001890AAC60047DDA0 /* ViewController.m */; }; 21 | 73238D031890AAC70047DDA0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 73238D021890AAC70047DDA0 /* Images.xcassets */; }; 22 | 73238D0A1890AAC70047DDA0 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73238D091890AAC70047DDA0 /* XCTest.framework */; }; 23 | 73238D0B1890AAC70047DDA0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73238CEA1890AAC60047DDA0 /* Foundation.framework */; }; 24 | 73238D0C1890AAC70047DDA0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73238CEE1890AAC60047DDA0 /* UIKit.framework */; }; 25 | 73238D141890AAC70047DDA0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 73238D121890AAC70047DDA0 /* InfoPlist.strings */; }; 26 | 73238D161890AAC70047DDA0 /* ImagePickerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 73238D151890AAC70047DDA0 /* ImagePickerTests.m */; }; 27 | 73238D231890AD4B0047DDA0 /* DoImagePickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 73238D211890AD4B0047DDA0 /* DoImagePickerController.m */; }; 28 | 73238D241890AD4B0047DDA0 /* DoImagePickerController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 73238D221890AD4B0047DDA0 /* DoImagePickerController.xib */; }; 29 | 73238D2A1890AF010047DDA0 /* DoAlbumCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 73238D291890AF010047DDA0 /* DoAlbumCell.m */; }; 30 | 73238D311890AF380047DDA0 /* DoAlbumCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 73238D301890AF380047DDA0 /* DoAlbumCell.xib */; }; 31 | 73238D341890C97F0047DDA0 /* AssetHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 73238D331890C97F0047DDA0 /* AssetHelper.m */; }; 32 | 73238D4D1890DC320047DDA0 /* DoPhotoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 73238D4C1890DC320047DDA0 /* DoPhotoCell.m */; }; 33 | 73238D4F1890DC4C0047DDA0 /* DoPhotoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 73238D4E1890DC4C0047DDA0 /* DoPhotoCell.xib */; }; 34 | 73C76E3518A109A8001C60EB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 73C76E3418A109A8001C60EB /* README.md */; }; 35 | 73E1110C18914C260011CBD3 /* check@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 73E1110818914C260011CBD3 /* check@2x.png */; }; 36 | 73E1110D18914C260011CBD3 /* close@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 73E1110918914C260011CBD3 /* close@2x.png */; }; 37 | 73E1110E18914C260011CBD3 /* down@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 73E1110A18914C260011CBD3 /* down@2x.png */; }; 38 | 73E1110F18914C260011CBD3 /* up@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 73E1110B18914C260011CBD3 /* up@2x.png */; }; 39 | 73E1111418915AEA0011CBD3 /* check.png in Resources */ = {isa = PBXBuildFile; fileRef = 73E1111018915AEA0011CBD3 /* check.png */; }; 40 | 73E1111518915AEA0011CBD3 /* close.png in Resources */ = {isa = PBXBuildFile; fileRef = 73E1111118915AEA0011CBD3 /* close.png */; }; 41 | 73E1111618915AEA0011CBD3 /* down.png in Resources */ = {isa = PBXBuildFile; fileRef = 73E1111218915AEA0011CBD3 /* down.png */; }; 42 | 73E1111718915AEA0011CBD3 /* up.png in Resources */ = {isa = PBXBuildFile; fileRef = 73E1111318915AEA0011CBD3 /* up.png */; }; 43 | /* End PBXBuildFile section */ 44 | 45 | /* Begin PBXContainerItemProxy section */ 46 | 73238D0D1890AAC70047DDA0 /* PBXContainerItemProxy */ = { 47 | isa = PBXContainerItemProxy; 48 | containerPortal = 73238CDF1890AAC60047DDA0 /* Project object */; 49 | proxyType = 1; 50 | remoteGlobalIDString = 73238CE61890AAC60047DDA0; 51 | remoteInfo = ImagePicker; 52 | }; 53 | /* End PBXContainerItemProxy section */ 54 | 55 | /* Begin PBXFileReference section */ 56 | 731D67C918A087A5002BAEF6 /* line@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "line@2x.png"; sourceTree = ""; }; 57 | 731D67CC18A0D066002BAEF6 /* show.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = show.png; sourceTree = ""; }; 58 | 731D67CD18A0D066002BAEF6 /* show@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "show@2x.png"; sourceTree = ""; }; 59 | 73238CE71890AAC60047DDA0 /* ImagePicker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ImagePicker.app; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 73238CEA1890AAC60047DDA0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 61 | 73238CEC1890AAC60047DDA0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 62 | 73238CEE1890AAC60047DDA0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 63 | 73238CF21890AAC60047DDA0 /* ImagePicker-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ImagePicker-Info.plist"; sourceTree = ""; }; 64 | 73238CF41890AAC60047DDA0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 65 | 73238CF61890AAC60047DDA0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 66 | 73238CF81890AAC60047DDA0 /* ImagePicker-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ImagePicker-Prefix.pch"; sourceTree = ""; }; 67 | 73238CF91890AAC60047DDA0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 68 | 73238CFA1890AAC60047DDA0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 69 | 73238CFD1890AAC60047DDA0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 70 | 73238CFF1890AAC60047DDA0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 71 | 73238D001890AAC60047DDA0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 72 | 73238D021890AAC70047DDA0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 73 | 73238D081890AAC70047DDA0 /* ImagePickerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImagePickerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 74 | 73238D091890AAC70047DDA0 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 75 | 73238D111890AAC70047DDA0 /* ImagePickerTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ImagePickerTests-Info.plist"; sourceTree = ""; }; 76 | 73238D131890AAC70047DDA0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 77 | 73238D151890AAC70047DDA0 /* ImagePickerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ImagePickerTests.m; sourceTree = ""; }; 78 | 73238D201890AD4B0047DDA0 /* DoImagePickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DoImagePickerController.h; sourceTree = ""; }; 79 | 73238D211890AD4B0047DDA0 /* DoImagePickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DoImagePickerController.m; sourceTree = ""; }; 80 | 73238D221890AD4B0047DDA0 /* DoImagePickerController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DoImagePickerController.xib; sourceTree = ""; }; 81 | 73238D281890AF010047DDA0 /* DoAlbumCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DoAlbumCell.h; sourceTree = ""; }; 82 | 73238D291890AF010047DDA0 /* DoAlbumCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DoAlbumCell.m; sourceTree = ""; }; 83 | 73238D301890AF380047DDA0 /* DoAlbumCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DoAlbumCell.xib; sourceTree = ""; }; 84 | 73238D321890C97F0047DDA0 /* AssetHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssetHelper.h; sourceTree = ""; }; 85 | 73238D331890C97F0047DDA0 /* AssetHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AssetHelper.m; sourceTree = ""; }; 86 | 73238D4B1890DC320047DDA0 /* DoPhotoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DoPhotoCell.h; sourceTree = ""; }; 87 | 73238D4C1890DC320047DDA0 /* DoPhotoCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DoPhotoCell.m; sourceTree = ""; }; 88 | 73238D4E1890DC4C0047DDA0 /* DoPhotoCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DoPhotoCell.xib; sourceTree = ""; }; 89 | 73C76E3418A109A8001C60EB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = SOURCE_ROOT; }; 90 | 73E1110818914C260011CBD3 /* check@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "check@2x.png"; sourceTree = ""; }; 91 | 73E1110918914C260011CBD3 /* close@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "close@2x.png"; sourceTree = ""; }; 92 | 73E1110A18914C260011CBD3 /* down@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "down@2x.png"; sourceTree = ""; }; 93 | 73E1110B18914C260011CBD3 /* up@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "up@2x.png"; sourceTree = ""; }; 94 | 73E1111018915AEA0011CBD3 /* check.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = check.png; sourceTree = ""; }; 95 | 73E1111118915AEA0011CBD3 /* close.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = close.png; sourceTree = ""; }; 96 | 73E1111218915AEA0011CBD3 /* down.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = down.png; sourceTree = ""; }; 97 | 73E1111318915AEA0011CBD3 /* up.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = up.png; sourceTree = ""; }; 98 | /* End PBXFileReference section */ 99 | 100 | /* Begin PBXFrameworksBuildPhase section */ 101 | 73238CE41890AAC60047DDA0 /* Frameworks */ = { 102 | isa = PBXFrameworksBuildPhase; 103 | buildActionMask = 2147483647; 104 | files = ( 105 | 73238CED1890AAC60047DDA0 /* CoreGraphics.framework in Frameworks */, 106 | 73238CEF1890AAC60047DDA0 /* UIKit.framework in Frameworks */, 107 | 73238CEB1890AAC60047DDA0 /* Foundation.framework in Frameworks */, 108 | ); 109 | runOnlyForDeploymentPostprocessing = 0; 110 | }; 111 | 73238D051890AAC70047DDA0 /* Frameworks */ = { 112 | isa = PBXFrameworksBuildPhase; 113 | buildActionMask = 2147483647; 114 | files = ( 115 | 73238D0A1890AAC70047DDA0 /* XCTest.framework in Frameworks */, 116 | 73238D0C1890AAC70047DDA0 /* UIKit.framework in Frameworks */, 117 | 73238D0B1890AAC70047DDA0 /* Foundation.framework in Frameworks */, 118 | ); 119 | runOnlyForDeploymentPostprocessing = 0; 120 | }; 121 | /* End PBXFrameworksBuildPhase section */ 122 | 123 | /* Begin PBXGroup section */ 124 | 73238CDE1890AAC60047DDA0 = { 125 | isa = PBXGroup; 126 | children = ( 127 | 73238CF01890AAC60047DDA0 /* ImagePicker */, 128 | 73238D0F1890AAC70047DDA0 /* ImagePickerTests */, 129 | 73238CE91890AAC60047DDA0 /* Frameworks */, 130 | 73238CE81890AAC60047DDA0 /* Products */, 131 | ); 132 | sourceTree = ""; 133 | }; 134 | 73238CE81890AAC60047DDA0 /* Products */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 73238CE71890AAC60047DDA0 /* ImagePicker.app */, 138 | 73238D081890AAC70047DDA0 /* ImagePickerTests.xctest */, 139 | ); 140 | name = Products; 141 | sourceTree = ""; 142 | }; 143 | 73238CE91890AAC60047DDA0 /* Frameworks */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 73238CEA1890AAC60047DDA0 /* Foundation.framework */, 147 | 73238CEC1890AAC60047DDA0 /* CoreGraphics.framework */, 148 | 73238CEE1890AAC60047DDA0 /* UIKit.framework */, 149 | 73238D091890AAC70047DDA0 /* XCTest.framework */, 150 | ); 151 | name = Frameworks; 152 | sourceTree = ""; 153 | }; 154 | 73238CF01890AAC60047DDA0 /* ImagePicker */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 73C76E3418A109A8001C60EB /* README.md */, 158 | 73238D1F1890AD2F0047DDA0 /* DoImagePicker */, 159 | 73238CF91890AAC60047DDA0 /* AppDelegate.h */, 160 | 73238CFA1890AAC60047DDA0 /* AppDelegate.m */, 161 | 73238CFC1890AAC60047DDA0 /* Main.storyboard */, 162 | 73238CFF1890AAC60047DDA0 /* ViewController.h */, 163 | 73238D001890AAC60047DDA0 /* ViewController.m */, 164 | 73238D021890AAC70047DDA0 /* Images.xcassets */, 165 | 73238D351890D4440047DDA0 /* Resources */, 166 | 73238CF11890AAC60047DDA0 /* Supporting Files */, 167 | ); 168 | path = ImagePicker; 169 | sourceTree = ""; 170 | }; 171 | 73238CF11890AAC60047DDA0 /* Supporting Files */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | 73238CF21890AAC60047DDA0 /* ImagePicker-Info.plist */, 175 | 73238CF31890AAC60047DDA0 /* InfoPlist.strings */, 176 | 73238CF61890AAC60047DDA0 /* main.m */, 177 | 73238CF81890AAC60047DDA0 /* ImagePicker-Prefix.pch */, 178 | ); 179 | name = "Supporting Files"; 180 | sourceTree = ""; 181 | }; 182 | 73238D0F1890AAC70047DDA0 /* ImagePickerTests */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | 73238D151890AAC70047DDA0 /* ImagePickerTests.m */, 186 | 73238D101890AAC70047DDA0 /* Supporting Files */, 187 | ); 188 | path = ImagePickerTests; 189 | sourceTree = ""; 190 | }; 191 | 73238D101890AAC70047DDA0 /* Supporting Files */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | 73238D111890AAC70047DDA0 /* ImagePickerTests-Info.plist */, 195 | 73238D121890AAC70047DDA0 /* InfoPlist.strings */, 196 | ); 197 | name = "Supporting Files"; 198 | sourceTree = ""; 199 | }; 200 | 73238D1F1890AD2F0047DDA0 /* DoImagePicker */ = { 201 | isa = PBXGroup; 202 | children = ( 203 | 73238D321890C97F0047DDA0 /* AssetHelper.h */, 204 | 73238D331890C97F0047DDA0 /* AssetHelper.m */, 205 | 73238D201890AD4B0047DDA0 /* DoImagePickerController.h */, 206 | 73238D211890AD4B0047DDA0 /* DoImagePickerController.m */, 207 | 73238D221890AD4B0047DDA0 /* DoImagePickerController.xib */, 208 | 73238D281890AF010047DDA0 /* DoAlbumCell.h */, 209 | 73238D291890AF010047DDA0 /* DoAlbumCell.m */, 210 | 73238D301890AF380047DDA0 /* DoAlbumCell.xib */, 211 | 73238D4B1890DC320047DDA0 /* DoPhotoCell.h */, 212 | 73238D4C1890DC320047DDA0 /* DoPhotoCell.m */, 213 | 73238D4E1890DC4C0047DDA0 /* DoPhotoCell.xib */, 214 | ); 215 | path = DoImagePicker; 216 | sourceTree = ""; 217 | }; 218 | 73238D351890D4440047DDA0 /* Resources */ = { 219 | isa = PBXGroup; 220 | children = ( 221 | 73E1110718914C260011CBD3 /* Images */, 222 | ); 223 | path = Resources; 224 | sourceTree = SOURCE_ROOT; 225 | }; 226 | 73E1110718914C260011CBD3 /* Images */ = { 227 | isa = PBXGroup; 228 | children = ( 229 | 731D67C918A087A5002BAEF6 /* line@2x.png */, 230 | 731D67CC18A0D066002BAEF6 /* show.png */, 231 | 731D67CD18A0D066002BAEF6 /* show@2x.png */, 232 | 73E1111018915AEA0011CBD3 /* check.png */, 233 | 73E1111118915AEA0011CBD3 /* close.png */, 234 | 73E1111218915AEA0011CBD3 /* down.png */, 235 | 73E1111318915AEA0011CBD3 /* up.png */, 236 | 73E1110818914C260011CBD3 /* check@2x.png */, 237 | 73E1110918914C260011CBD3 /* close@2x.png */, 238 | 73E1110A18914C260011CBD3 /* down@2x.png */, 239 | 73E1110B18914C260011CBD3 /* up@2x.png */, 240 | ); 241 | name = Images; 242 | path = Resources/Images; 243 | sourceTree = SOURCE_ROOT; 244 | }; 245 | /* End PBXGroup section */ 246 | 247 | /* Begin PBXNativeTarget section */ 248 | 73238CE61890AAC60047DDA0 /* ImagePicker */ = { 249 | isa = PBXNativeTarget; 250 | buildConfigurationList = 73238D191890AAC70047DDA0 /* Build configuration list for PBXNativeTarget "ImagePicker" */; 251 | buildPhases = ( 252 | 73238CE31890AAC60047DDA0 /* Sources */, 253 | 73238CE41890AAC60047DDA0 /* Frameworks */, 254 | 73238CE51890AAC60047DDA0 /* Resources */, 255 | ); 256 | buildRules = ( 257 | ); 258 | dependencies = ( 259 | ); 260 | name = ImagePicker; 261 | productName = ImagePicker; 262 | productReference = 73238CE71890AAC60047DDA0 /* ImagePicker.app */; 263 | productType = "com.apple.product-type.application"; 264 | }; 265 | 73238D071890AAC70047DDA0 /* ImagePickerTests */ = { 266 | isa = PBXNativeTarget; 267 | buildConfigurationList = 73238D1C1890AAC70047DDA0 /* Build configuration list for PBXNativeTarget "ImagePickerTests" */; 268 | buildPhases = ( 269 | 73238D041890AAC70047DDA0 /* Sources */, 270 | 73238D051890AAC70047DDA0 /* Frameworks */, 271 | 73238D061890AAC70047DDA0 /* Resources */, 272 | ); 273 | buildRules = ( 274 | ); 275 | dependencies = ( 276 | 73238D0E1890AAC70047DDA0 /* PBXTargetDependency */, 277 | ); 278 | name = ImagePickerTests; 279 | productName = ImagePickerTests; 280 | productReference = 73238D081890AAC70047DDA0 /* ImagePickerTests.xctest */; 281 | productType = "com.apple.product-type.bundle.unit-test"; 282 | }; 283 | /* End PBXNativeTarget section */ 284 | 285 | /* Begin PBXProject section */ 286 | 73238CDF1890AAC60047DDA0 /* Project object */ = { 287 | isa = PBXProject; 288 | attributes = { 289 | LastUpgradeCheck = 0500; 290 | ORGANIZATIONNAME = "Seungbo Cho"; 291 | TargetAttributes = { 292 | 73238CE61890AAC60047DDA0 = { 293 | DevelopmentTeam = GXDY7L4VT8; 294 | }; 295 | 73238D071890AAC70047DDA0 = { 296 | TestTargetID = 73238CE61890AAC60047DDA0; 297 | }; 298 | }; 299 | }; 300 | buildConfigurationList = 73238CE21890AAC60047DDA0 /* Build configuration list for PBXProject "ImagePicker" */; 301 | compatibilityVersion = "Xcode 3.2"; 302 | developmentRegion = English; 303 | hasScannedForEncodings = 0; 304 | knownRegions = ( 305 | en, 306 | Base, 307 | ); 308 | mainGroup = 73238CDE1890AAC60047DDA0; 309 | productRefGroup = 73238CE81890AAC60047DDA0 /* Products */; 310 | projectDirPath = ""; 311 | projectRoot = ""; 312 | targets = ( 313 | 73238CE61890AAC60047DDA0 /* ImagePicker */, 314 | 73238D071890AAC70047DDA0 /* ImagePickerTests */, 315 | ); 316 | }; 317 | /* End PBXProject section */ 318 | 319 | /* Begin PBXResourcesBuildPhase section */ 320 | 73238CE51890AAC60047DDA0 /* Resources */ = { 321 | isa = PBXResourcesBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | 73E1111718915AEA0011CBD3 /* up.png in Resources */, 325 | 73238D311890AF380047DDA0 /* DoAlbumCell.xib in Resources */, 326 | 73238D241890AD4B0047DDA0 /* DoImagePickerController.xib in Resources */, 327 | 73238D031890AAC70047DDA0 /* Images.xcassets in Resources */, 328 | 73E1111618915AEA0011CBD3 /* down.png in Resources */, 329 | 73E1110F18914C260011CBD3 /* up@2x.png in Resources */, 330 | 73C76E3518A109A8001C60EB /* README.md in Resources */, 331 | 73E1111418915AEA0011CBD3 /* check.png in Resources */, 332 | 73238CF51890AAC60047DDA0 /* InfoPlist.strings in Resources */, 333 | 73E1111518915AEA0011CBD3 /* close.png in Resources */, 334 | 73238CFE1890AAC60047DDA0 /* Main.storyboard in Resources */, 335 | 73E1110E18914C260011CBD3 /* down@2x.png in Resources */, 336 | 731D67CA18A087A5002BAEF6 /* line@2x.png in Resources */, 337 | 731D67CE18A0D066002BAEF6 /* show.png in Resources */, 338 | 73238D4F1890DC4C0047DDA0 /* DoPhotoCell.xib in Resources */, 339 | 73E1110C18914C260011CBD3 /* check@2x.png in Resources */, 340 | 731D67CF18A0D066002BAEF6 /* show@2x.png in Resources */, 341 | 73E1110D18914C260011CBD3 /* close@2x.png in Resources */, 342 | ); 343 | runOnlyForDeploymentPostprocessing = 0; 344 | }; 345 | 73238D061890AAC70047DDA0 /* Resources */ = { 346 | isa = PBXResourcesBuildPhase; 347 | buildActionMask = 2147483647; 348 | files = ( 349 | 73238D141890AAC70047DDA0 /* InfoPlist.strings in Resources */, 350 | ); 351 | runOnlyForDeploymentPostprocessing = 0; 352 | }; 353 | /* End PBXResourcesBuildPhase section */ 354 | 355 | /* Begin PBXSourcesBuildPhase section */ 356 | 73238CE31890AAC60047DDA0 /* Sources */ = { 357 | isa = PBXSourcesBuildPhase; 358 | buildActionMask = 2147483647; 359 | files = ( 360 | 73238D341890C97F0047DDA0 /* AssetHelper.m in Sources */, 361 | 73238D4D1890DC320047DDA0 /* DoPhotoCell.m in Sources */, 362 | 73238D231890AD4B0047DDA0 /* DoImagePickerController.m in Sources */, 363 | 73238D2A1890AF010047DDA0 /* DoAlbumCell.m in Sources */, 364 | 73238D011890AAC60047DDA0 /* ViewController.m in Sources */, 365 | 73238CFB1890AAC60047DDA0 /* AppDelegate.m in Sources */, 366 | 73238CF71890AAC60047DDA0 /* main.m in Sources */, 367 | ); 368 | runOnlyForDeploymentPostprocessing = 0; 369 | }; 370 | 73238D041890AAC70047DDA0 /* Sources */ = { 371 | isa = PBXSourcesBuildPhase; 372 | buildActionMask = 2147483647; 373 | files = ( 374 | 73238D161890AAC70047DDA0 /* ImagePickerTests.m in Sources */, 375 | ); 376 | runOnlyForDeploymentPostprocessing = 0; 377 | }; 378 | /* End PBXSourcesBuildPhase section */ 379 | 380 | /* Begin PBXTargetDependency section */ 381 | 73238D0E1890AAC70047DDA0 /* PBXTargetDependency */ = { 382 | isa = PBXTargetDependency; 383 | target = 73238CE61890AAC60047DDA0 /* ImagePicker */; 384 | targetProxy = 73238D0D1890AAC70047DDA0 /* PBXContainerItemProxy */; 385 | }; 386 | /* End PBXTargetDependency section */ 387 | 388 | /* Begin PBXVariantGroup section */ 389 | 73238CF31890AAC60047DDA0 /* InfoPlist.strings */ = { 390 | isa = PBXVariantGroup; 391 | children = ( 392 | 73238CF41890AAC60047DDA0 /* en */, 393 | ); 394 | name = InfoPlist.strings; 395 | sourceTree = ""; 396 | }; 397 | 73238CFC1890AAC60047DDA0 /* Main.storyboard */ = { 398 | isa = PBXVariantGroup; 399 | children = ( 400 | 73238CFD1890AAC60047DDA0 /* Base */, 401 | ); 402 | name = Main.storyboard; 403 | sourceTree = ""; 404 | }; 405 | 73238D121890AAC70047DDA0 /* InfoPlist.strings */ = { 406 | isa = PBXVariantGroup; 407 | children = ( 408 | 73238D131890AAC70047DDA0 /* en */, 409 | ); 410 | name = InfoPlist.strings; 411 | sourceTree = ""; 412 | }; 413 | /* End PBXVariantGroup section */ 414 | 415 | /* Begin XCBuildConfiguration section */ 416 | 73238D171890AAC70047DDA0 /* Debug */ = { 417 | isa = XCBuildConfiguration; 418 | buildSettings = { 419 | ALWAYS_SEARCH_USER_PATHS = NO; 420 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 421 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 422 | CLANG_CXX_LIBRARY = "libc++"; 423 | CLANG_ENABLE_MODULES = YES; 424 | CLANG_ENABLE_OBJC_ARC = YES; 425 | CLANG_WARN_BOOL_CONVERSION = YES; 426 | CLANG_WARN_CONSTANT_CONVERSION = YES; 427 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 428 | CLANG_WARN_EMPTY_BODY = YES; 429 | CLANG_WARN_ENUM_CONVERSION = YES; 430 | CLANG_WARN_INT_CONVERSION = YES; 431 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 432 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 433 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 434 | COPY_PHASE_STRIP = NO; 435 | GCC_C_LANGUAGE_STANDARD = gnu99; 436 | GCC_DYNAMIC_NO_PIC = NO; 437 | GCC_OPTIMIZATION_LEVEL = 0; 438 | GCC_PREPROCESSOR_DEFINITIONS = ( 439 | "DEBUG=1", 440 | "$(inherited)", 441 | ); 442 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 443 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 444 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 445 | GCC_WARN_UNDECLARED_SELECTOR = YES; 446 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 447 | GCC_WARN_UNUSED_FUNCTION = YES; 448 | GCC_WARN_UNUSED_VARIABLE = YES; 449 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 450 | ONLY_ACTIVE_ARCH = YES; 451 | SDKROOT = iphoneos; 452 | }; 453 | name = Debug; 454 | }; 455 | 73238D181890AAC70047DDA0 /* Release */ = { 456 | isa = XCBuildConfiguration; 457 | buildSettings = { 458 | ALWAYS_SEARCH_USER_PATHS = NO; 459 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 460 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 461 | CLANG_CXX_LIBRARY = "libc++"; 462 | CLANG_ENABLE_MODULES = YES; 463 | CLANG_ENABLE_OBJC_ARC = YES; 464 | CLANG_WARN_BOOL_CONVERSION = YES; 465 | CLANG_WARN_CONSTANT_CONVERSION = YES; 466 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 467 | CLANG_WARN_EMPTY_BODY = YES; 468 | CLANG_WARN_ENUM_CONVERSION = YES; 469 | CLANG_WARN_INT_CONVERSION = YES; 470 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 471 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 472 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 473 | COPY_PHASE_STRIP = YES; 474 | ENABLE_NS_ASSERTIONS = NO; 475 | GCC_C_LANGUAGE_STANDARD = gnu99; 476 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 477 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 478 | GCC_WARN_UNDECLARED_SELECTOR = YES; 479 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 480 | GCC_WARN_UNUSED_FUNCTION = YES; 481 | GCC_WARN_UNUSED_VARIABLE = YES; 482 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 483 | SDKROOT = iphoneos; 484 | VALIDATE_PRODUCT = YES; 485 | }; 486 | name = Release; 487 | }; 488 | 73238D1A1890AAC70047DDA0 /* Debug */ = { 489 | isa = XCBuildConfiguration; 490 | buildSettings = { 491 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 492 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 493 | CODE_SIGN_IDENTITY = "iPhone Developer"; 494 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 495 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 496 | GCC_PREFIX_HEADER = "ImagePicker/ImagePicker-Prefix.pch"; 497 | INFOPLIST_FILE = "ImagePicker/ImagePicker-Info.plist"; 498 | PRODUCT_NAME = "$(TARGET_NAME)"; 499 | PROVISIONING_PROFILE = ""; 500 | WRAPPER_EXTENSION = app; 501 | }; 502 | name = Debug; 503 | }; 504 | 73238D1B1890AAC70047DDA0 /* Release */ = { 505 | isa = XCBuildConfiguration; 506 | buildSettings = { 507 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 508 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 509 | CODE_SIGN_IDENTITY = "iPhone Developer"; 510 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 511 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 512 | GCC_PREFIX_HEADER = "ImagePicker/ImagePicker-Prefix.pch"; 513 | INFOPLIST_FILE = "ImagePicker/ImagePicker-Info.plist"; 514 | PRODUCT_NAME = "$(TARGET_NAME)"; 515 | PROVISIONING_PROFILE = ""; 516 | WRAPPER_EXTENSION = app; 517 | }; 518 | name = Release; 519 | }; 520 | 73238D1D1890AAC70047DDA0 /* Debug */ = { 521 | isa = XCBuildConfiguration; 522 | buildSettings = { 523 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 524 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ImagePicker.app/ImagePicker"; 525 | FRAMEWORK_SEARCH_PATHS = ( 526 | "$(SDKROOT)/Developer/Library/Frameworks", 527 | "$(inherited)", 528 | "$(DEVELOPER_FRAMEWORKS_DIR)", 529 | ); 530 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 531 | GCC_PREFIX_HEADER = "ImagePicker/ImagePicker-Prefix.pch"; 532 | GCC_PREPROCESSOR_DEFINITIONS = ( 533 | "DEBUG=1", 534 | "$(inherited)", 535 | ); 536 | INFOPLIST_FILE = "ImagePickerTests/ImagePickerTests-Info.plist"; 537 | PRODUCT_NAME = "$(TARGET_NAME)"; 538 | TEST_HOST = "$(BUNDLE_LOADER)"; 539 | WRAPPER_EXTENSION = xctest; 540 | }; 541 | name = Debug; 542 | }; 543 | 73238D1E1890AAC70047DDA0 /* Release */ = { 544 | isa = XCBuildConfiguration; 545 | buildSettings = { 546 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 547 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ImagePicker.app/ImagePicker"; 548 | FRAMEWORK_SEARCH_PATHS = ( 549 | "$(SDKROOT)/Developer/Library/Frameworks", 550 | "$(inherited)", 551 | "$(DEVELOPER_FRAMEWORKS_DIR)", 552 | ); 553 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 554 | GCC_PREFIX_HEADER = "ImagePicker/ImagePicker-Prefix.pch"; 555 | INFOPLIST_FILE = "ImagePickerTests/ImagePickerTests-Info.plist"; 556 | PRODUCT_NAME = "$(TARGET_NAME)"; 557 | TEST_HOST = "$(BUNDLE_LOADER)"; 558 | WRAPPER_EXTENSION = xctest; 559 | }; 560 | name = Release; 561 | }; 562 | /* End XCBuildConfiguration section */ 563 | 564 | /* Begin XCConfigurationList section */ 565 | 73238CE21890AAC60047DDA0 /* Build configuration list for PBXProject "ImagePicker" */ = { 566 | isa = XCConfigurationList; 567 | buildConfigurations = ( 568 | 73238D171890AAC70047DDA0 /* Debug */, 569 | 73238D181890AAC70047DDA0 /* Release */, 570 | ); 571 | defaultConfigurationIsVisible = 0; 572 | defaultConfigurationName = Release; 573 | }; 574 | 73238D191890AAC70047DDA0 /* Build configuration list for PBXNativeTarget "ImagePicker" */ = { 575 | isa = XCConfigurationList; 576 | buildConfigurations = ( 577 | 73238D1A1890AAC70047DDA0 /* Debug */, 578 | 73238D1B1890AAC70047DDA0 /* Release */, 579 | ); 580 | defaultConfigurationIsVisible = 0; 581 | defaultConfigurationName = Release; 582 | }; 583 | 73238D1C1890AAC70047DDA0 /* Build configuration list for PBXNativeTarget "ImagePickerTests" */ = { 584 | isa = XCConfigurationList; 585 | buildConfigurations = ( 586 | 73238D1D1890AAC70047DDA0 /* Debug */, 587 | 73238D1E1890AAC70047DDA0 /* Release */, 588 | ); 589 | defaultConfigurationIsVisible = 0; 590 | defaultConfigurationName = Release; 591 | }; 592 | /* End XCConfigurationList section */ 593 | }; 594 | rootObject = 73238CDF1890AAC60047DDA0 /* Project object */; 595 | } 596 | -------------------------------------------------------------------------------- /ImagePicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ImagePicker.xcodeproj/project.xcworkspace/xcshareddata/ImagePicker.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 663A9C6B-1B3F-41E1-A66F-AC4A2E8DA8C6 9 | IDESourceControlProjectName 10 | ImagePicker 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 53914F7A-695E-460E-A681-C2F69F56103D 14 | https://github.com/donobono/DoImagePickerController.git 15 | 16 | IDESourceControlProjectPath 17 | ImagePicker.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 53914F7A-695E-460E-A681-C2F69F56103D 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/donobono/DoImagePickerController.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 53914F7A-695E-460E-A681-C2F69F56103D 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 53914F7A-695E-460E-A681-C2F69F56103D 36 | IDESourceControlWCCName 37 | DoImagePickerController 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ImagePicker.xcodeproj/project.xcworkspace/xcuserdata/seungbocho.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/ImagePicker.xcodeproj/project.xcworkspace/xcuserdata/seungbocho.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ImagePicker.xcodeproj/xcuserdata/seungbocho.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ImagePicker.xcodeproj/xcuserdata/seungbocho.xcuserdatad/xcschemes/ImagePicker.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /ImagePicker.xcodeproj/xcuserdata/seungbocho.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ImagePicker.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 73238CE61890AAC60047DDA0 16 | 17 | primary 18 | 19 | 20 | 73238D071890AAC70047DDA0 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ImagePicker/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ImagePicker 4 | // 5 | // Created by Seungbo Cho on 2014. 1. 23.. 6 | // Copyright (c) 2014년 Seungbo Cho. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ImagePicker/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ImagePicker 4 | // 5 | // Created by Seungbo Cho on 2014. 1. 23.. 6 | // Copyright (c) 2014년 Seungbo Cho. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /ImagePicker/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 73 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/AssetHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // AssetHelper.m 3 | // DoImagePickerController 4 | // 5 | // Created by Donobono on 2014. 1. 23.. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | #define ASSETHELPER [AssetHelper sharedAssetHelper] 12 | 13 | #define ASSET_PHOTO_THUMBNAIL 0 14 | #define ASSET_PHOTO_ASPECT_THUMBNAIL 1 15 | #define ASSET_PHOTO_SCREEN_SIZE 2 16 | #define ASSET_PHOTO_FULL_RESOLUTION 3 17 | 18 | @interface AssetHelper : NSObject 19 | 20 | - (void)initAsset; 21 | 22 | @property (nonatomic, strong) ALAssetsLibrary *assetsLibrary; 23 | @property (nonatomic, strong) NSMutableArray *assetPhotos; 24 | @property (nonatomic, strong) NSMutableArray *assetGroups; 25 | 26 | @property (readwrite) BOOL bReverse; 27 | 28 | + (AssetHelper *)sharedAssetHelper; 29 | 30 | // get album list from asset 31 | - (void)getGroupList:(void (^)(NSArray *))result; 32 | // get photos from specific album with ALAssetsGroup object 33 | - (void)getPhotoListOfGroup:(ALAssetsGroup *)alGroup result:(void (^)(NSArray *))result; 34 | // get photos from specific album with index of album array 35 | - (void)getPhotoListOfGroupByIndex:(NSInteger)nGroupIndex result:(void (^)(NSArray *))result; 36 | // get photos from camera roll 37 | - (void)getSavedPhotoList:(void (^)(NSArray *))result error:(void (^)(NSError *))error; 38 | 39 | - (NSInteger)getGroupCount; 40 | - (NSInteger)getPhotoCountOfCurrentGroup; 41 | - (NSDictionary *)getGroupInfo:(NSInteger)nIndex; 42 | 43 | - (void)clearData; 44 | 45 | // utils 46 | - (UIImage *)getCroppedImage:(NSURL *)urlImage; 47 | - (UIImage *)getImageFromAsset:(ALAsset *)asset type:(NSInteger)nType; 48 | - (UIImage *)getImageAtIndex:(NSInteger)nIndex type:(NSInteger)nType; 49 | - (ALAsset *)getAssetAtIndex:(NSInteger)nIndex; 50 | - (ALAssetsGroup *)getGroupAtIndex:(NSInteger)nIndex; 51 | 52 | @end 53 | 54 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/AssetHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // AssetHelper.m 3 | // DoImagePickerController 4 | // 5 | // Created by Donobono on 2014. 1. 23.. 6 | // 7 | 8 | #import "AssetHelper.h" 9 | 10 | @implementation AssetHelper 11 | 12 | 13 | + (AssetHelper *)sharedAssetHelper 14 | { 15 | static AssetHelper *_sharedInstance = nil; 16 | static dispatch_once_t onceToken; 17 | dispatch_once(&onceToken, ^{ 18 | _sharedInstance = [[AssetHelper alloc] init]; 19 | [_sharedInstance initAsset]; 20 | }); 21 | 22 | return _sharedInstance; 23 | } 24 | 25 | - (void)initAsset 26 | { 27 | if (self.assetsLibrary == nil) 28 | { 29 | _assetsLibrary = [[ALAssetsLibrary alloc] init]; 30 | 31 | NSString *strVersion = [[UIDevice alloc] systemVersion]; 32 | if ([strVersion compare:@"5"] >= 0) 33 | [_assetsLibrary writeImageToSavedPhotosAlbum:nil metadata:nil completionBlock:^(NSURL *assetURL, NSError *error) { 34 | }]; 35 | } 36 | } 37 | 38 | - (void)setCameraRollAtFirst 39 | { 40 | for (ALAssetsGroup *group in _assetGroups) 41 | { 42 | if ([[group valueForProperty:@"ALAssetsGroupPropertyType"] intValue] == ALAssetsGroupSavedPhotos) 43 | { 44 | // send to head 45 | [_assetGroups removeObject:group]; 46 | [_assetGroups insertObject:group atIndex:0]; 47 | 48 | return; 49 | } 50 | } 51 | } 52 | 53 | - (void)getGroupList:(void (^)(NSArray *))result 54 | { 55 | [self initAsset]; 56 | 57 | void (^assetGroupEnumerator)(ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop) 58 | { 59 | [group setAssetsFilter:[ALAssetsFilter allPhotos]]; 60 | 61 | if (group == nil) 62 | { 63 | if (_bReverse) 64 | _assetGroups = [[NSMutableArray alloc] initWithArray:[[_assetGroups reverseObjectEnumerator] allObjects]]; 65 | 66 | [self setCameraRollAtFirst]; 67 | 68 | // end of enumeration 69 | result(_assetGroups); 70 | return; 71 | } 72 | 73 | [_assetGroups addObject:group]; 74 | }; 75 | 76 | void (^assetGroupEnumberatorFailure)(NSError *) = ^(NSError *error) 77 | { 78 | NSLog(@"Error : %@", [error description]); 79 | }; 80 | 81 | _assetGroups = [[NSMutableArray alloc] init]; 82 | [_assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll 83 | usingBlock:assetGroupEnumerator 84 | failureBlock:assetGroupEnumberatorFailure]; 85 | } 86 | 87 | - (void)getPhotoListOfGroup:(ALAssetsGroup *)alGroup result:(void (^)(NSArray *))result 88 | { 89 | [self initAsset]; 90 | 91 | _assetPhotos = [[NSMutableArray alloc] init]; 92 | [alGroup setAssetsFilter:[ALAssetsFilter allPhotos]]; 93 | [alGroup enumerateAssetsUsingBlock:^(ALAsset *alPhoto, NSUInteger index, BOOL *stop) { 94 | 95 | if(alPhoto == nil) 96 | { 97 | if (_bReverse) 98 | _assetPhotos = [[NSMutableArray alloc] initWithArray:[[_assetPhotos reverseObjectEnumerator] allObjects]]; 99 | 100 | result(_assetPhotos); 101 | return; 102 | } 103 | 104 | [_assetPhotos addObject:alPhoto]; 105 | }]; 106 | } 107 | 108 | - (void)getPhotoListOfGroupByIndex:(NSInteger)nGroupIndex result:(void (^)(NSArray *))result 109 | { 110 | [self getPhotoListOfGroup:_assetGroups[nGroupIndex] result:^(NSArray *aResult) { 111 | 112 | result(_assetPhotos); 113 | 114 | }]; 115 | } 116 | 117 | - (void)getSavedPhotoList:(void (^)(NSArray *))result error:(void (^)(NSError *))error 118 | { 119 | [self initAsset]; 120 | 121 | dispatch_async(dispatch_get_main_queue(), ^{ 122 | 123 | void (^assetGroupEnumerator)(ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop) 124 | { 125 | if ([[group valueForProperty:@"ALAssetsGroupPropertyType"] intValue] == ALAssetsGroupSavedPhotos) 126 | { 127 | [group setAssetsFilter:[ALAssetsFilter allPhotos]]; 128 | 129 | [group enumerateAssetsUsingBlock:^(ALAsset *alPhoto, NSUInteger index, BOOL *stop) { 130 | 131 | if(alPhoto == nil) 132 | { 133 | if (_bReverse) 134 | _assetPhotos = [[NSMutableArray alloc] initWithArray:[[_assetPhotos reverseObjectEnumerator] allObjects]]; 135 | 136 | result(_assetPhotos); 137 | return; 138 | } 139 | 140 | [_assetPhotos addObject:alPhoto]; 141 | }]; 142 | } 143 | }; 144 | 145 | void (^assetGroupEnumberatorFailure)(NSError *) = ^(NSError *err) 146 | { 147 | NSLog(@"Error : %@", [err description]); 148 | error(err); 149 | }; 150 | 151 | _assetPhotos = [[NSMutableArray alloc] init]; 152 | [_assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos 153 | usingBlock:assetGroupEnumerator 154 | failureBlock:assetGroupEnumberatorFailure]; 155 | }); 156 | } 157 | 158 | - (NSInteger)getGroupCount 159 | { 160 | return _assetGroups.count; 161 | } 162 | 163 | - (NSInteger)getPhotoCountOfCurrentGroup 164 | { 165 | return _assetPhotos.count; 166 | } 167 | 168 | - (NSDictionary *)getGroupInfo:(NSInteger)nIndex 169 | { 170 | return @{@"name" : [_assetGroups[nIndex] valueForProperty:ALAssetsGroupPropertyName], 171 | @"count" : @([_assetGroups[nIndex] numberOfAssets])}; 172 | } 173 | 174 | - (void)clearData 175 | { 176 | _assetGroups = nil; 177 | _assetPhotos = nil; 178 | } 179 | 180 | #pragma mark - utils 181 | - (UIImage *)getCroppedImage:(NSURL *)urlImage 182 | { 183 | __block UIImage *iImage = nil; 184 | __block BOOL bBusy = YES; 185 | 186 | ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) 187 | { 188 | ALAssetRepresentation *rep = [myasset defaultRepresentation]; 189 | NSString *strXMP = rep.metadata[@"AdjustmentXMP"]; 190 | if (strXMP == nil || [strXMP isKindOfClass:[NSNull class]]) 191 | { 192 | CGImageRef iref = [rep fullResolutionImage]; 193 | if (iref) 194 | iImage = [UIImage imageWithCGImage:iref scale:1.0 orientation:(UIImageOrientation)rep.orientation]; 195 | else 196 | iImage = nil; 197 | } 198 | else 199 | { 200 | // to get edited photo by photo app 201 | NSData *dXMP = [strXMP dataUsingEncoding:NSUTF8StringEncoding]; 202 | 203 | CIImage *image = [CIImage imageWithCGImage:rep.fullResolutionImage]; 204 | 205 | NSError *error = nil; 206 | NSArray *filterArray = [CIFilter filterArrayFromSerializedXMP:dXMP 207 | inputImageExtent:image.extent 208 | error:&error]; 209 | if (error) { 210 | NSLog(@"Error during CIFilter creation: %@", [error localizedDescription]); 211 | } 212 | 213 | for (CIFilter *filter in filterArray) { 214 | [filter setValue:image forKey:kCIInputImageKey]; 215 | image = [filter outputImage]; 216 | } 217 | 218 | iImage = [UIImage imageWithCIImage:image scale:1.0 orientation:(UIImageOrientation)rep.orientation]; 219 | } 220 | 221 | bBusy = NO; 222 | }; 223 | 224 | ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror) 225 | { 226 | NSLog(@"booya, cant get image - %@",[myerror localizedDescription]); 227 | }; 228 | 229 | [_assetsLibrary assetForURL:urlImage 230 | resultBlock:resultblock 231 | failureBlock:failureblock]; 232 | 233 | while (bBusy) 234 | [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; 235 | 236 | return iImage; 237 | } 238 | 239 | - (UIImage *)getImageFromAsset:(ALAsset *)asset type:(NSInteger)nType 240 | { 241 | CGImageRef iRef = nil; 242 | 243 | if (nType == ASSET_PHOTO_THUMBNAIL) 244 | iRef = [asset thumbnail]; 245 | else if (nType == ASSET_PHOTO_ASPECT_THUMBNAIL) 246 | iRef = [asset aspectRatioThumbnail]; 247 | else if (nType == ASSET_PHOTO_SCREEN_SIZE) 248 | iRef = [asset.defaultRepresentation fullScreenImage]; 249 | else if (nType == ASSET_PHOTO_FULL_RESOLUTION) 250 | { 251 | NSString *strXMP = asset.defaultRepresentation.metadata[@"AdjustmentXMP"]; 252 | if (strXMP == nil || [strXMP isKindOfClass:[NSNull class]]) 253 | { 254 | iRef = [asset.defaultRepresentation fullResolutionImage]; 255 | return [UIImage imageWithCGImage:iRef scale:1.0 orientation:(UIImageOrientation)asset.defaultRepresentation.orientation]; 256 | } 257 | else 258 | { 259 | NSData *dXMP = [strXMP dataUsingEncoding:NSUTF8StringEncoding]; 260 | 261 | CIImage *image = [CIImage imageWithCGImage:asset.defaultRepresentation.fullResolutionImage]; 262 | 263 | NSError *error = nil; 264 | NSArray *filterArray = [CIFilter filterArrayFromSerializedXMP:dXMP 265 | inputImageExtent:image.extent 266 | error:&error]; 267 | if (error) { 268 | NSLog(@"Error during CIFilter creation: %@", [error localizedDescription]); 269 | } 270 | 271 | for (CIFilter *filter in filterArray) { 272 | [filter setValue:image forKey:kCIInputImageKey]; 273 | image = [filter outputImage]; 274 | } 275 | 276 | UIImage *iImage = [UIImage imageWithCIImage:image scale:1.0 orientation:(UIImageOrientation)asset.defaultRepresentation.orientation]; 277 | return iImage; 278 | } 279 | } 280 | 281 | return [UIImage imageWithCGImage:iRef]; 282 | } 283 | 284 | - (UIImage *)getImageAtIndex:(NSInteger)nIndex type:(NSInteger)nType 285 | { 286 | return [self getImageFromAsset:(ALAsset *)_assetPhotos[nIndex] type:nType]; 287 | } 288 | 289 | - (ALAsset *)getAssetAtIndex:(NSInteger)nIndex 290 | { 291 | return _assetPhotos[nIndex]; 292 | } 293 | 294 | - (ALAssetsGroup *)getGroupAtIndex:(NSInteger)nIndex 295 | { 296 | return _assetGroups[nIndex]; 297 | } 298 | 299 | @end 300 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/DoAlbumCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DoAlbumCell.h 3 | // DoImagePickerController 4 | // 5 | // Created by Donobono on 2014. 1. 23.. 6 | // 7 | 8 | #import 9 | 10 | @interface DoAlbumCell : UITableViewCell 11 | 12 | @property (weak, nonatomic) IBOutlet UILabel *lbAlbumName; 13 | @property (weak, nonatomic) IBOutlet UILabel *lbCount; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/DoAlbumCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DoAlbumCell.m 3 | // DoImagePickerController 4 | // 5 | // Created by Donobono on 2014. 1. 23.. 6 | // 7 | 8 | #import "DoAlbumCell.h" 9 | #import "DoImagePickerController.h" 10 | 11 | @implementation DoAlbumCell 12 | 13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 23 | { 24 | [super setSelected:selected animated:animated]; 25 | 26 | if (selected) 27 | { 28 | _lbAlbumName.textColor = [UIColor whiteColor]; 29 | _lbCount.textColor = [UIColor whiteColor]; 30 | 31 | self.contentView.backgroundColor = DO_ALBUM_NAME_TEXT_COLOR; 32 | } 33 | else 34 | { 35 | _lbAlbumName.textColor = DO_ALBUM_NAME_TEXT_COLOR; 36 | _lbCount.textColor = DO_ALBUM_COUNT_TEXT_COLOR; 37 | 38 | self.contentView.backgroundColor = [UIColor whiteColor]; 39 | } 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/DoAlbumCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 23 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/DoImagePickerController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DoImagePickerController.h 3 | // DoImagePickerController 4 | // 5 | // Created by Donobono on 2014. 1. 23.. 6 | // 7 | 8 | #import 9 | 10 | #define DO_RGB(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1] 11 | #define DO_RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a] 12 | 13 | #define DO_MENU_BACK_COLOR DO_RGBA(57, 185, 238, 0.98) 14 | #define DO_SIDE_BUTTON_COLOR DO_RGBA(57, 185, 238, 0.9) 15 | 16 | #define DO_ALBUM_NAME_TEXT_COLOR DO_RGB(57, 185, 238) 17 | #define DO_ALBUM_COUNT_TEXT_COLOR DO_RGB(247, 200, 142) 18 | #define DO_BOTTOM_TEXT_COLOR DO_RGB(255, 255, 255) 19 | 20 | #define DO_PICKER_RESULT_UIIMAGE 0 21 | #define DO_PICKER_RESULT_ASSET 1 22 | 23 | #define DO_NO_LIMIT_SELECT -1 24 | 25 | 26 | // if you don't want to save selected album, remove this. 27 | #define DO_SAVE_SELECTED_ALBUM 28 | 29 | @interface DoImagePickerController : UIViewController 30 | 31 | @property (assign, nonatomic) id delegate; 32 | 33 | @property (readwrite) NSInteger nMaxCount; // -1 : no limit 34 | @property (readwrite) NSInteger nColumnCount; // 2, 3, or 4 35 | @property (readwrite) NSInteger nResultType; // default : DO_PICKER_RESULT_UIIMAGE 36 | 37 | @property (weak, nonatomic) IBOutlet UICollectionView *cvPhotoList; 38 | @property (weak, nonatomic) IBOutlet UITableView *tvAlbumList; 39 | @property (weak, nonatomic) IBOutlet UIView *vDimmed; 40 | 41 | 42 | // init 43 | - (void)initControls; 44 | - (void)readAlbumList:(BOOL)bFirst; 45 | 46 | // bottom menu 47 | @property (weak, nonatomic) IBOutlet UIView *vBottomMenu; 48 | @property (weak, nonatomic) IBOutlet UIButton *btSelectAlbum; 49 | @property (weak, nonatomic) IBOutlet UIButton *btOK; 50 | @property (weak, nonatomic) IBOutlet UIImageView *ivLine1; 51 | @property (weak, nonatomic) IBOutlet UIImageView *ivLine2; 52 | @property (weak, nonatomic) IBOutlet UILabel *lbSelectCount; 53 | @property (weak, nonatomic) IBOutlet UIImageView *ivShowMark; 54 | 55 | - (void)initBottomMenu; 56 | - (IBAction)onSelectPhoto:(id)sender; 57 | - (IBAction)onCancel:(id)sender; 58 | - (IBAction)onSelectAlbum:(id)sender; 59 | - (void)hideBottomMenu; 60 | 61 | 62 | // side buttons 63 | @property (weak, nonatomic) IBOutlet UIButton *btUp; 64 | @property (weak, nonatomic) IBOutlet UIButton *btDown; 65 | 66 | - (IBAction)onUp:(id)sender; 67 | - (IBAction)onDown:(id)sender; 68 | 69 | 70 | // photos 71 | @property (strong, nonatomic) UIImageView *ivPreview; 72 | 73 | - (void)showPhotosInGroup:(NSInteger)nIndex; // nIndex : index in album array 74 | - (void)showPreview:(NSInteger)nIndex; // nIndex : index in photo array 75 | - (void)hidePreview; 76 | 77 | 78 | // select photos 79 | @property (strong, nonatomic) NSMutableDictionary *dSelected; 80 | @property (strong, nonatomic) NSIndexPath *lastAccessed; 81 | 82 | @end 83 | 84 | @protocol DoImagePickerControllerDelegate 85 | 86 | - (void)didCancelDoImagePickerController; 87 | - (void)didSelectPhotosFromDoImagePickerController:(DoImagePickerController *)picker result:(NSArray *)aSelected; 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/DoImagePickerController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DoImagePickerController.m 3 | // DoImagePickerController 4 | // 5 | // Created by Donobono on 2014. 1. 23.. 6 | // 7 | 8 | #import "DoImagePickerController.h" 9 | #import "AssetHelper.h" 10 | 11 | #import "DoAlbumCell.h" 12 | #import "DoPhotoCell.h" 13 | 14 | @implementation DoImagePickerController 15 | 16 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 17 | { 18 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 19 | if (self) { 20 | // Custom initialization 21 | } 22 | return self; 23 | } 24 | 25 | - (void)viewDidLoad 26 | { 27 | [super viewDidLoad]; 28 | 29 | [self initBottomMenu]; 30 | [self initControls]; 31 | 32 | UINib *nib = [UINib nibWithNibName:@"DoPhotoCell" bundle:nil]; 33 | [_cvPhotoList registerNib:nib forCellWithReuseIdentifier:@"DoPhotoCell"]; 34 | 35 | _tvAlbumList.frame = CGRectMake(0, _vBottomMenu.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height); 36 | _tvAlbumList.alpha = 0.0; 37 | 38 | [self readAlbumList:YES]; 39 | 40 | // new photo is located at the first of array 41 | ASSETHELPER.bReverse = YES; 42 | 43 | if (_nMaxCount != 1) 44 | { 45 | // init gesture for multiple selection with panning 46 | UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(onPanForSelection:)]; 47 | [self.view addGestureRecognizer:pan]; 48 | } 49 | 50 | // init gesture for preview 51 | UILongPressGestureRecognizer *longTap = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(onLongTapForPreview:)]; 52 | longTap.minimumPressDuration = 0.3; 53 | [self.view addGestureRecognizer:longTap]; 54 | 55 | // add observer for refresh asset data 56 | [[NSNotificationCenter defaultCenter] addObserver: self 57 | selector: @selector(handleEnterForeground:) 58 | name: UIApplicationWillEnterForegroundNotification 59 | object: nil]; 60 | } 61 | 62 | - (void)viewDidDisappear:(BOOL)animated 63 | { 64 | if (_nResultType == DO_PICKER_RESULT_UIIMAGE) 65 | [ASSETHELPER clearData]; 66 | 67 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil]; 68 | } 69 | 70 | - (void)handleEnterForeground:(NSNotification*)notification 71 | { 72 | [self readAlbumList:NO]; 73 | } 74 | 75 | #pragma mark - for init 76 | - (void)initControls 77 | { 78 | // side buttons 79 | _btUp.backgroundColor = DO_SIDE_BUTTON_COLOR; 80 | _btDown.backgroundColor = DO_SIDE_BUTTON_COLOR; 81 | 82 | CALayer *layer1 = [_btDown layer]; 83 | [layer1 setMasksToBounds:YES]; 84 | [layer1 setCornerRadius:_btDown.frame.size.height / 2.0 - 1]; 85 | 86 | CALayer *layer2 = [_btUp layer]; 87 | [layer2 setMasksToBounds:YES]; 88 | [layer2 setCornerRadius:_btUp.frame.size.height / 2.0 - 1]; 89 | 90 | // table view 91 | UIImageView *ivHeader = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, _tvAlbumList.frame.size.width, 0.5)]; 92 | ivHeader.backgroundColor = DO_ALBUM_NAME_TEXT_COLOR; 93 | _tvAlbumList.tableHeaderView = ivHeader; 94 | 95 | UIImageView *ivFooter = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, _tvAlbumList.frame.size.width, 0.5)]; 96 | ivFooter.backgroundColor = DO_ALBUM_NAME_TEXT_COLOR; 97 | _tvAlbumList.tableFooterView = ivFooter; 98 | 99 | // dimmed view 100 | _vDimmed.alpha = 0.0; 101 | _vDimmed.frame = self.view.frame; 102 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapOnDimmedView:)]; 103 | [_vDimmed addGestureRecognizer:tap]; 104 | } 105 | 106 | - (void)readAlbumList:(BOOL)bFirst 107 | { 108 | [ASSETHELPER getGroupList:^(NSArray *aGroups) { 109 | 110 | [_tvAlbumList reloadData]; 111 | 112 | NSInteger nIndex = 0; 113 | #ifdef DO_SAVE_SELECTED_ALBUM 114 | nIndex = [self getSelectedGroupIndex:aGroups]; 115 | if (nIndex < 0) 116 | nIndex = 0; 117 | #endif 118 | [_tvAlbumList selectRowAtIndexPath:[NSIndexPath indexPathForRow:nIndex inSection:0] animated:NO scrollPosition:UITableViewScrollPositionTop]; 119 | [_btSelectAlbum setTitle:[ASSETHELPER getGroupInfo:nIndex][@"name"] forState:UIControlStateNormal]; 120 | 121 | [self showPhotosInGroup:nIndex]; 122 | 123 | if (aGroups.count == 1) 124 | _btSelectAlbum.enabled = NO; 125 | 126 | // calculate tableview's height 127 | _tvAlbumList.frame = CGRectMake(_tvAlbumList.frame.origin.x, _tvAlbumList.frame.origin.y, _tvAlbumList.frame.size.width, MIN(aGroups.count * 50, 200)); 128 | }]; 129 | } 130 | 131 | #pragma mark - for bottom menu 132 | - (void)initBottomMenu 133 | { 134 | _vBottomMenu.backgroundColor = DO_MENU_BACK_COLOR; 135 | [_btSelectAlbum setTitleColor:DO_BOTTOM_TEXT_COLOR forState:UIControlStateNormal]; 136 | [_btSelectAlbum setTitleColor:DO_BOTTOM_TEXT_COLOR forState:UIControlStateDisabled]; 137 | 138 | _ivLine1.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"line.png"]]; 139 | _ivLine2.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"line.png"]]; 140 | 141 | if (_nMaxCount == DO_NO_LIMIT_SELECT) 142 | { 143 | _lbSelectCount.text = @"(0)"; 144 | _lbSelectCount.textColor = DO_BOTTOM_TEXT_COLOR; 145 | } 146 | else if (_nMaxCount <= 1) 147 | { 148 | // hide ok button 149 | _btOK.hidden = YES; 150 | _ivLine1.hidden = YES; 151 | 152 | CGRect rect = _btSelectAlbum.frame; 153 | rect.size.width = rect.size.width + 60; 154 | _btSelectAlbum.frame = rect; 155 | 156 | _lbSelectCount.hidden = YES; 157 | } 158 | else 159 | { 160 | _lbSelectCount.text = [NSString stringWithFormat:@"(0/%d)", (int)_nMaxCount]; 161 | _lbSelectCount.textColor = DO_BOTTOM_TEXT_COLOR; 162 | } 163 | } 164 | 165 | - (IBAction)onSelectPhoto:(id)sender 166 | { 167 | NSMutableArray *aResult = [[NSMutableArray alloc] initWithCapacity:_dSelected.count]; 168 | NSArray *aKeys = [_dSelected keysSortedByValueUsingSelector:@selector(compare:)]; 169 | 170 | if (_nResultType == DO_PICKER_RESULT_UIIMAGE) 171 | { 172 | for (int i = 0; i < _dSelected.count; i++) 173 | { 174 | UIImage *iSelected = [ASSETHELPER getImageAtIndex:[aKeys[i] integerValue] type:ASSET_PHOTO_SCREEN_SIZE]; 175 | if (iSelected != nil) 176 | [aResult addObject:iSelected]; 177 | } 178 | } 179 | else 180 | { 181 | for (int i = 0; i < _dSelected.count; i++) 182 | [aResult addObject:[ASSETHELPER getAssetAtIndex:[aKeys[i] integerValue]]]; 183 | } 184 | 185 | [_delegate didSelectPhotosFromDoImagePickerController:self result:aResult]; 186 | } 187 | 188 | - (IBAction)onCancel:(id)sender 189 | { 190 | [_delegate didCancelDoImagePickerController]; 191 | } 192 | 193 | - (IBAction)onSelectAlbum:(id)sender 194 | { 195 | if (_tvAlbumList.frame.origin.y == _vBottomMenu.frame.origin.y) 196 | { 197 | // show tableview 198 | [UIView animateWithDuration:0.2 animations:^(void) { 199 | 200 | _vDimmed.alpha = 0.7; 201 | 202 | _tvAlbumList.frame = CGRectMake(0, _vBottomMenu.frame.origin.y - _tvAlbumList.frame.size.height, 203 | _tvAlbumList.frame.size.width, _tvAlbumList.frame.size.height); 204 | _tvAlbumList.alpha = 1.0; 205 | 206 | _ivShowMark.transform = CGAffineTransformMakeRotation(M_PI); 207 | }]; 208 | } 209 | else 210 | { 211 | // hide tableview 212 | [self hideBottomMenu]; 213 | } 214 | } 215 | 216 | #pragma mark - for side buttons 217 | - (void)onTapOnDimmedView:(UITapGestureRecognizer *)tap 218 | { 219 | if (tap.state == UIGestureRecognizerStateEnded) 220 | { 221 | [self hideBottomMenu]; 222 | 223 | if (_ivPreview != nil) 224 | [self hidePreview]; 225 | } 226 | } 227 | 228 | - (IBAction)onUp:(id)sender 229 | { 230 | [_cvPhotoList scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UICollectionViewScrollPositionTop animated:YES]; 231 | } 232 | 233 | - (IBAction)onDown:(id)sender 234 | { 235 | [_cvPhotoList scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:[ASSETHELPER getPhotoCountOfCurrentGroup] - 1 inSection:0] atScrollPosition:UICollectionViewScrollPositionTop animated:YES]; 236 | } 237 | 238 | #pragma mark - UITableViewDelegate for selecting album 239 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 240 | { 241 | return [ASSETHELPER getGroupCount]; 242 | } 243 | 244 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 245 | { 246 | DoAlbumCell *cell = (DoAlbumCell*)[tableView dequeueReusableCellWithIdentifier:@"DoAlbumCell"]; 247 | 248 | if (cell == nil) 249 | { 250 | cell = [[[NSBundle mainBundle] loadNibNamed:@"DoAlbumCell" owner:nil options:nil] lastObject]; 251 | } 252 | 253 | NSDictionary *d = [ASSETHELPER getGroupInfo:indexPath.row]; 254 | cell.lbAlbumName.text = d[@"name"]; 255 | cell.lbCount.text = [NSString stringWithFormat:@"%@", d[@"count"]]; 256 | 257 | return cell; 258 | } 259 | 260 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 261 | { 262 | [self showPhotosInGroup:indexPath.row]; 263 | [_btSelectAlbum setTitle:[ASSETHELPER getGroupInfo:indexPath.row][@"name"] forState:UIControlStateNormal]; 264 | 265 | [self hideBottomMenu]; 266 | } 267 | 268 | - (void)hideBottomMenu 269 | { 270 | [UIView animateWithDuration:0.2 animations:^(void) { 271 | 272 | _vDimmed.alpha = 0.0; 273 | 274 | _tvAlbumList.frame = CGRectMake(0, _vBottomMenu.frame.origin.y, _tvAlbumList.frame.size.width, _tvAlbumList.frame.size.height); 275 | _ivShowMark.transform = CGAffineTransformMakeRotation(0); 276 | 277 | [UIView setAnimationDelay:0.1]; 278 | 279 | _tvAlbumList.alpha = 0.0; 280 | }]; 281 | } 282 | 283 | #pragma mark - UICollectionViewDelegates for photos 284 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 285 | { 286 | return [ASSETHELPER getPhotoCountOfCurrentGroup]; 287 | } 288 | 289 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 290 | { 291 | DoPhotoCell *cell = (DoPhotoCell *)[_cvPhotoList dequeueReusableCellWithReuseIdentifier:@"DoPhotoCell" forIndexPath:indexPath]; 292 | 293 | if (_nColumnCount == 4) 294 | cell.ivPhoto.image = [ASSETHELPER getImageAtIndex:indexPath.row type:ASSET_PHOTO_THUMBNAIL]; 295 | else 296 | cell.ivPhoto.image = [ASSETHELPER getImageAtIndex:indexPath.row type:ASSET_PHOTO_ASPECT_THUMBNAIL]; 297 | 298 | 299 | if (_dSelected[@(indexPath.row)] == nil) 300 | [cell setSelectMode:NO]; 301 | else 302 | [cell setSelectMode:YES]; 303 | 304 | return cell; 305 | } 306 | 307 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 308 | { 309 | if (_nMaxCount > 1 || _nMaxCount == DO_NO_LIMIT_SELECT) 310 | { 311 | DoPhotoCell *cell = (DoPhotoCell *)[collectionView cellForItemAtIndexPath:indexPath]; 312 | 313 | if ((_dSelected[@(indexPath.row)] == nil) && (_nMaxCount > _dSelected.count)) 314 | { 315 | // select 316 | _dSelected[@(indexPath.row)] = @(_dSelected.count); 317 | [cell setSelectMode:YES]; 318 | } 319 | else 320 | { 321 | // unselect 322 | [_dSelected removeObjectForKey:@(indexPath.row)]; 323 | [cell setSelectMode:NO]; 324 | } 325 | 326 | if (_nMaxCount == DO_NO_LIMIT_SELECT) 327 | _lbSelectCount.text = [NSString stringWithFormat:@"(%d)", (int)_dSelected.count]; 328 | else 329 | _lbSelectCount.text = [NSString stringWithFormat:@"(%d/%d)", (int)_dSelected.count, (int)_nMaxCount]; 330 | } 331 | else 332 | { 333 | if (_nResultType == DO_PICKER_RESULT_UIIMAGE) 334 | [_delegate didSelectPhotosFromDoImagePickerController:self result:@[[ASSETHELPER getImageAtIndex:indexPath.row type:ASSET_PHOTO_SCREEN_SIZE]]]; 335 | else 336 | [_delegate didSelectPhotosFromDoImagePickerController:self result:@[[ASSETHELPER getAssetAtIndex:indexPath.row]]]; 337 | } 338 | } 339 | 340 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 341 | { 342 | if (_nColumnCount == 2) 343 | return CGSizeMake(158, 158); 344 | else if (_nColumnCount == 3) 345 | return CGSizeMake(104, 104); 346 | else if (_nColumnCount == 4) 347 | return CGSizeMake(77, 77); 348 | 349 | return CGSizeZero; 350 | } 351 | 352 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 353 | { 354 | if (scrollView == _cvPhotoList) 355 | { 356 | [UIView animateWithDuration:0.2 animations:^(void) { 357 | if (scrollView.contentOffset.y <= 50) 358 | _btUp.alpha = 0.0; 359 | else 360 | _btUp.alpha = 1.0; 361 | 362 | if (scrollView.contentOffset.y + scrollView.frame.size.height >= scrollView.contentSize.height) 363 | _btDown.alpha = 0.0; 364 | else 365 | _btDown.alpha = 1.0; 366 | }]; 367 | } 368 | } 369 | 370 | // for multiple selection with panning 371 | - (void)onPanForSelection:(UIPanGestureRecognizer *)gestureRecognizer 372 | { 373 | if (_ivPreview != nil) 374 | return; 375 | 376 | double fX = [gestureRecognizer locationInView:_cvPhotoList].x; 377 | double fY = [gestureRecognizer locationInView:_cvPhotoList].y; 378 | 379 | for (UICollectionViewCell *cell in _cvPhotoList.visibleCells) 380 | { 381 | float fSX = cell.frame.origin.x; 382 | float fEX = cell.frame.origin.x + cell.frame.size.width; 383 | float fSY = cell.frame.origin.y; 384 | float fEY = cell.frame.origin.y + cell.frame.size.height; 385 | 386 | if (fX >= fSX && fX <= fEX && fY >= fSY && fY <= fEY) 387 | { 388 | NSIndexPath *indexPath = [_cvPhotoList indexPathForCell:cell]; 389 | 390 | if (_lastAccessed != indexPath) 391 | { 392 | [self collectionView:_cvPhotoList didSelectItemAtIndexPath:indexPath]; 393 | } 394 | 395 | _lastAccessed = indexPath; 396 | } 397 | } 398 | 399 | if (gestureRecognizer.state == UIGestureRecognizerStateEnded) 400 | { 401 | _lastAccessed = nil; 402 | _cvPhotoList.scrollEnabled = YES; 403 | } 404 | } 405 | 406 | // for preview 407 | - (void)onLongTapForPreview:(UILongPressGestureRecognizer *)gestureRecognizer 408 | { 409 | if (_ivPreview != nil) 410 | return; 411 | 412 | if (gestureRecognizer.state == UIGestureRecognizerStateBegan) 413 | { 414 | double fX = [gestureRecognizer locationInView:_cvPhotoList].x; 415 | double fY = [gestureRecognizer locationInView:_cvPhotoList].y; 416 | 417 | // check boundary of controls 418 | CGPoint pt = [gestureRecognizer locationInView:self.view]; 419 | if (CGRectContainsPoint(_vBottomMenu.frame, pt)) 420 | return; 421 | if (_btDown.alpha == 1.0 && CGRectContainsPoint(_btDown.frame, pt)) 422 | return; 423 | if (_btUp.alpha == 1.0 && CGRectContainsPoint(_btUp.frame, pt)) 424 | return; 425 | 426 | NSIndexPath *indexPath = nil; 427 | for (UICollectionViewCell *cell in _cvPhotoList.visibleCells) 428 | { 429 | float fSX = cell.frame.origin.x; 430 | float fEX = cell.frame.origin.x + cell.frame.size.width; 431 | float fSY = cell.frame.origin.y; 432 | float fEY = cell.frame.origin.y + cell.frame.size.height; 433 | 434 | if (fX >= fSX && fX <= fEX && fY >= fSY && fY <= fEY) 435 | { 436 | indexPath = [_cvPhotoList indexPathForCell:cell]; 437 | break; 438 | } 439 | } 440 | 441 | if (indexPath != nil) 442 | [self showPreview:indexPath.row]; 443 | } 444 | } 445 | 446 | #pragma mark - for photos 447 | - (void)showPhotosInGroup:(NSInteger)nIndex 448 | { 449 | if (_nMaxCount == DO_NO_LIMIT_SELECT) 450 | { 451 | _dSelected = [[NSMutableDictionary alloc] init]; 452 | _lbSelectCount.text = @"(0)"; 453 | } 454 | else if (_nMaxCount > 1) 455 | { 456 | _dSelected = [[NSMutableDictionary alloc] initWithCapacity:_nMaxCount]; 457 | _lbSelectCount.text = [NSString stringWithFormat:@"(0/%d)", (int)_nMaxCount]; 458 | } 459 | 460 | [ASSETHELPER getPhotoListOfGroupByIndex:nIndex result:^(NSArray *aPhotos) { 461 | 462 | [_cvPhotoList reloadData]; 463 | 464 | _cvPhotoList.alpha = 0.3; 465 | [UIView animateWithDuration:0.2 animations:^(void) { 466 | [UIView setAnimationDelay:0.1]; 467 | _cvPhotoList.alpha = 1.0; 468 | }]; 469 | 470 | if (aPhotos.count > 0) 471 | { 472 | [_cvPhotoList scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UICollectionViewScrollPositionTop animated:NO]; 473 | } 474 | 475 | _btUp.alpha = 0.0; 476 | 477 | dispatch_async(dispatch_get_main_queue(), ^(void) { 478 | if (_cvPhotoList.contentSize.height < _cvPhotoList.frame.size.height) 479 | _btDown.alpha = 0.0; 480 | else 481 | _btDown.alpha = 1.0; 482 | }); 483 | }]; 484 | 485 | #ifdef DO_SAVE_SELECTED_ALBUM 486 | // save selected album 487 | [self saveSelectedGroup:nIndex]; 488 | #endif 489 | 490 | } 491 | 492 | - (void)showPreview:(NSInteger)nIndex 493 | { 494 | [self.view bringSubviewToFront:_vDimmed]; 495 | 496 | _ivPreview = [[UIImageView alloc] initWithFrame:_vDimmed.frame]; 497 | _ivPreview.contentMode = UIViewContentModeScaleAspectFit; 498 | _ivPreview.autoresizingMask = _vDimmed.autoresizingMask; 499 | [_vDimmed addSubview:_ivPreview]; 500 | 501 | _ivPreview.image = [ASSETHELPER getImageAtIndex:nIndex type:ASSET_PHOTO_SCREEN_SIZE]; 502 | 503 | // add gesture for close preview 504 | UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(onPanToClosePreview:)]; 505 | [_vDimmed addGestureRecognizer:pan]; 506 | 507 | [UIView animateWithDuration:0.2 animations:^(void) { 508 | _vDimmed.alpha = 1.0; 509 | }]; 510 | } 511 | 512 | - (void)hidePreview 513 | { 514 | [self.view bringSubviewToFront:_tvAlbumList]; 515 | [self.view bringSubviewToFront:_vBottomMenu]; 516 | 517 | [_ivPreview removeFromSuperview]; 518 | _ivPreview = nil; 519 | 520 | _vDimmed.alpha = 0.0; 521 | [_vDimmed removeGestureRecognizer:[_vDimmed.gestureRecognizers lastObject]]; 522 | } 523 | 524 | - (void)onPanToClosePreview:(UIPanGestureRecognizer *)gestureRecognizer 525 | { 526 | CGPoint translation = [gestureRecognizer translationInView:self.view]; 527 | 528 | if (gestureRecognizer.state == UIGestureRecognizerStateEnded) 529 | { 530 | [UIView animateWithDuration:0.2 animations:^(void) { 531 | 532 | if (_vDimmed.alpha < 0.7) // close preview 533 | { 534 | CGPoint pt = _ivPreview.center; 535 | if (_ivPreview.center.y > _vDimmed.center.y) 536 | pt.y = self.view.frame.size.height * 1.5; 537 | else if (_ivPreview.center.y < _vDimmed.center.y) 538 | pt.y = -self.view.frame.size.height * 1.5; 539 | 540 | _ivPreview.center = pt; 541 | 542 | [self hidePreview]; 543 | } 544 | else 545 | { 546 | _vDimmed.alpha = 1.0; 547 | _ivPreview.center = _vDimmed.center; 548 | } 549 | 550 | }]; 551 | } 552 | else 553 | { 554 | _ivPreview.center = CGPointMake(_ivPreview.center.x, _ivPreview.center.y + translation.y); 555 | [gestureRecognizer setTranslation:CGPointMake(0, 0) inView:self.view]; 556 | 557 | _vDimmed.alpha = 1 - ABS(_ivPreview.center.y - _vDimmed.center.y) / (self.view.frame.size.height / 2.0); 558 | } 559 | } 560 | 561 | #pragma mark - save selected album 562 | - (void)saveSelectedGroup:(NSInteger)nIndex 563 | { 564 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 565 | 566 | [defaults setObject:[[ASSETHELPER getGroupAtIndex:nIndex] valueForProperty:ALAssetsGroupPropertyName] forKey:@"DO_SELECTED_ALBUM"]; 567 | [defaults synchronize]; 568 | 569 | NSLog(@"[[ASSETHELPER getGroupAtIndex:nIndex] valueForProperty:ALAssetsGroupPropertyName] : %@", [[ASSETHELPER getGroupAtIndex:nIndex] valueForProperty:ALAssetsGroupPropertyName]); 570 | } 571 | 572 | - (NSString *)loadSelectedGroup 573 | { 574 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 575 | 576 | NSLog(@"---------> %@", [defaults objectForKey:@"DO_SELECTED_ALBUM"]); 577 | 578 | return [defaults objectForKey:@"DO_SELECTED_ALBUM"]; 579 | } 580 | 581 | - (NSInteger)getSelectedGroupIndex:(NSArray *)aGroups 582 | { 583 | NSString *strOldAlbumName = [self loadSelectedGroup]; 584 | for (int i = 0; i < aGroups.count; i++) 585 | { 586 | NSDictionary *d = [ASSETHELPER getGroupInfo:i]; 587 | if ([d[@"name"] isEqualToString:strOldAlbumName]) 588 | return i; 589 | } 590 | 591 | return -1; 592 | } 593 | 594 | #pragma mark - Others 595 | - (void)didReceiveMemoryWarning 596 | { 597 | [super didReceiveMemoryWarning]; 598 | // Dispose of any resources that can be recreated. 599 | } 600 | 601 | - (BOOL)prefersStatusBarHidden 602 | { 603 | return YES; 604 | } 605 | 606 | @end 607 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/DoImagePickerController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 56 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 94 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 126 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/DoPhotoCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DoPhotoCell.h 3 | // DoImagePickerController 4 | // 5 | // Created by Donobono on 2014. 1. 23.. 6 | // 7 | 8 | #import 9 | 10 | @interface DoPhotoCell : UICollectionViewCell 11 | 12 | @property (weak, nonatomic) IBOutlet UIImageView *ivPhoto; 13 | @property (weak, nonatomic) IBOutlet UIView *vSelect; 14 | 15 | - (void)setSelectMode:(BOOL)bSelect; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/DoPhotoCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DoPhotoCell.m 3 | // DoImagePickerController 4 | // 5 | // Created by Donobono on 2014. 1. 23.. 6 | // 7 | 8 | #import "DoPhotoCell.h" 9 | 10 | @implementation DoPhotoCell 11 | 12 | - (id)initWithFrame:(CGRect)frame 13 | { 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | // Initialization code 17 | } 18 | return self; 19 | } 20 | 21 | - (void)setSelectMode:(BOOL)bSelect 22 | { 23 | if (bSelect) 24 | _ivPhoto.alpha = 0.2; 25 | else 26 | _ivPhoto.alpha = 1.0; 27 | } 28 | 29 | /* 30 | // Only override drawRect: if you perform custom drawing. 31 | // An empty implementation adversely affects performance during animation. 32 | - (void)drawRect:(CGRect)rect 33 | { 34 | // Drawing code 35 | } 36 | */ 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /ImagePicker/DoImagePicker/DoPhotoCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ImagePicker/ImagePicker-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.lovelyhoy.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ImagePicker/ImagePicker-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /ImagePicker/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /ImagePicker/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /ImagePicker/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ImagePicker 4 | // 5 | // Created by Seungbo Cho on 2014. 1. 23.. 6 | // Copyright (c) 2014년 Seungbo Cho. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DoImagePickerController.h" 11 | 12 | @interface ViewController : UIViewController 13 | 14 | @property (weak, nonatomic) IBOutlet UIImageView *iv1; 15 | @property (weak, nonatomic) IBOutlet UIImageView *iv2; 16 | @property (weak, nonatomic) IBOutlet UIImageView *iv3; 17 | @property (weak, nonatomic) IBOutlet UIImageView *iv4; 18 | @property (strong, nonatomic) NSArray *aIVs; 19 | 20 | @property (weak, nonatomic) IBOutlet UISegmentedControl *sgColumnCount; 21 | @property (weak, nonatomic) IBOutlet UISegmentedControl *sgMaxCount; 22 | 23 | - (IBAction)onShowImagePicker:(id)sender; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ImagePicker/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ImagePicker 4 | // 5 | // Created by Seungbo Cho on 2014. 1. 23.. 6 | // Copyright (c) 2014년 Seungbo Cho. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "AssetHelper.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | 22 | _aIVs = @[_iv1, _iv2, _iv3, _iv4]; 23 | _sgColumnCount.selectedSegmentIndex = 1; 24 | _sgMaxCount.selectedSegmentIndex = 1; 25 | } 26 | 27 | - (void)didReceiveMemoryWarning 28 | { 29 | [super didReceiveMemoryWarning]; 30 | // Dispose of any resources that can be recreated. 31 | } 32 | 33 | - (IBAction)onShowImagePicker:(id)sender 34 | { 35 | for (UIImageView *iv in _aIVs) 36 | iv.image = nil; 37 | 38 | DoImagePickerController *cont = [[DoImagePickerController alloc] initWithNibName:@"DoImagePickerController" bundle:nil]; 39 | cont.delegate = self; 40 | cont.nResultType = DO_PICKER_RESULT_UIIMAGE; 41 | if (_sgMaxCount.selectedSegmentIndex == 0) 42 | cont.nMaxCount = 1; 43 | else if (_sgMaxCount.selectedSegmentIndex == 1) 44 | cont.nMaxCount = 4; 45 | else if (_sgMaxCount.selectedSegmentIndex == 2) 46 | { 47 | cont.nMaxCount = DO_NO_LIMIT_SELECT; 48 | cont.nResultType = DO_PICKER_RESULT_ASSET; // if you want to get lots photos, you'd better use this mode for memory!!! 49 | } 50 | 51 | cont.nColumnCount = _sgColumnCount.selectedSegmentIndex + 2; 52 | 53 | [self presentViewController:cont animated:YES completion:nil]; 54 | } 55 | 56 | #pragma mark - DoImagePickerControllerDelegate 57 | - (void)didCancelDoImagePickerController 58 | { 59 | [self dismissViewControllerAnimated:YES completion:nil]; 60 | } 61 | 62 | - (void)didSelectPhotosFromDoImagePickerController:(DoImagePickerController *)picker result:(NSArray *)aSelected 63 | { 64 | [self dismissViewControllerAnimated:YES completion:nil]; 65 | 66 | if (picker.nResultType == DO_PICKER_RESULT_UIIMAGE) 67 | { 68 | for (int i = 0; i < MIN(4, aSelected.count); i++) 69 | { 70 | UIImageView *iv = _aIVs[i]; 71 | iv.image = aSelected[i]; 72 | } 73 | } 74 | else if (picker.nResultType == DO_PICKER_RESULT_ASSET) 75 | { 76 | for (int i = 0; i < MIN(4, aSelected.count); i++) 77 | { 78 | UIImageView *iv = _aIVs[i]; 79 | iv.image = [ASSETHELPER getImageFromAsset:aSelected[i] type:ASSET_PHOTO_SCREEN_SIZE]; 80 | } 81 | 82 | [ASSETHELPER clearData]; 83 | } 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /ImagePicker/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ImagePicker/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ImagePicker 4 | // 5 | // Created by Seungbo Cho on 2014. 1. 23.. 6 | // Copyright (c) 2014년 Seungbo Cho. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ImagePickerTests/ImagePickerTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.lovelyhoy.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ImagePickerTests/ImagePickerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImagePickerTests.m 3 | // ImagePickerTests 4 | // 5 | // Created by Seungbo Cho on 2014. 1. 23.. 6 | // Copyright (c) 2014년 Seungbo Cho. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ImagePickerTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ImagePickerTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ImagePickerTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 donobono 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DoImagePickerController 2 | ======================= 3 | 4 | An image picker controller with single selection and multiple selection. Support to select lots photos with panning gesture. 5 | 6 | ## Preview 7 | 8 |

Demo video

9 | 10 | ### various column count : 2, 3 and 4 11 | ![DoImagePickerController Screenshot](https://raw.github.com/donobono/DoImagePickerController/master/p1.jpg) 12 | 13 | ### select multiple photos with pan gesture 14 | ![DoImagePickerController Screenshot](https://raw.github.com/donobono/DoImagePickerController/master/p2.jpg) 15 | 16 | ### select album 17 | ![DoImagePickerController Screenshot](https://raw.github.com/donobono/DoImagePickerController/master/p3.jpg) 18 | 19 | ### landscape mode 20 | ![DoImagePickerController Screenshot](https://raw.github.com/donobono/DoImagePickerController/master/p4.jpg) 21 | 22 | ## Requirements 23 | - iOS 7.0 and greater 24 | - ARC 25 | 26 | 27 | ## Features 28 | - adjustable column count : 2 ~ 4 29 | - adjustable count to select photos 30 | - multiple selection with pan gesture 31 | - landscape mode 32 | - go top or botom directly by tapping right side buttons 33 | - long tap on thumbnail to show preview 34 | - tap or drag preview to close preview 35 | 36 | 37 | ## Examples 38 | 39 | - AssetHelper : helper class for asset 40 | 41 | **Code:** 42 | 43 | ```objc 44 | 45 | // YES : old photo -> new photo 46 | // NO : new photo -> old photo 47 | @property (readwrite) BOOL bReverse; 48 | 49 | 50 | // methods to get asset data 51 | - (void)getGroupList:(void (^)(NSArray *))result; 52 | - (void)getPhotoListOfGroup:(ALAssetsGroup *)alGroup result:(void (^)(NSArray *))result; 53 | - (void)getPhotoListOfGroupByIndex:(NSInteger)nGroupIndex result:(void (^)(NSArray *))result; 54 | - (void)getSavedPhotoList:(void (^)(NSArray *))result error:(void (^)(NSError *))error; 55 | 56 | 57 | ``` 58 | 59 | 60 | - DoImagePickerController 61 | 62 | **Code:** 63 | 64 | ```objc 65 | 66 | DoImagePickerController *cont = [[DoImagePickerController alloc] initWithNibName:@"DoImagePickerController" bundle:nil]; 67 | cont.delegate = self; 68 | cont.nMaxCount = 4; // larger than 1 69 | cont.nColumnCount = 3; // 2, 3, or 4 70 | 71 | cont.nResultType = DO_PICKER_RESULT_UIIMAGE; // get UIImage object array : common case 72 | // if you want to get lots photos, you had better use DO_PICKER_RESULT_ASSET. 73 | 74 | [self presentViewController:cont animated:YES completion:nil]; 75 | 76 | ``` 77 | 78 | 79 | ## Credits 80 | 81 | DoImagePickerController was created by Dono Cho. 82 | 83 | 84 | ## License 85 | 86 | DoImagePickerController is available under the MIT license. See the LICENSE file for more info. 87 | 88 | 89 | ## Icon images from 90 | http://dribbble.com/KounterB 91 | 92 | thank you so much for sharing awesome icons!!! -------------------------------------------------------------------------------- /Resources/Images/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/check.png -------------------------------------------------------------------------------- /Resources/Images/check@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/check@2x.png -------------------------------------------------------------------------------- /Resources/Images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/close.png -------------------------------------------------------------------------------- /Resources/Images/close@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/close@2x.png -------------------------------------------------------------------------------- /Resources/Images/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/down.png -------------------------------------------------------------------------------- /Resources/Images/down@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/down@2x.png -------------------------------------------------------------------------------- /Resources/Images/line@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/line@2x.png -------------------------------------------------------------------------------- /Resources/Images/show.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/show.png -------------------------------------------------------------------------------- /Resources/Images/show@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/show@2x.png -------------------------------------------------------------------------------- /Resources/Images/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/up.png -------------------------------------------------------------------------------- /Resources/Images/up@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/Resources/Images/up@2x.png -------------------------------------------------------------------------------- /p1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/p1.jpg -------------------------------------------------------------------------------- /p2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/p2.jpg -------------------------------------------------------------------------------- /p3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/p3.jpg -------------------------------------------------------------------------------- /p4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donobono/DoImagePickerController/7ffcdd17dc866649f0e32e0220b64e314eee5b7e/p4.jpg --------------------------------------------------------------------------------