ImagePickerSheetController

ImagePickerSheetController replicates the custom photo action sheet in iMessage.

  • 所有者: lbrndnr/ImagePickerSheetController
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

ImagePickerSheetController

Twitter: @lbrndnr
License
Carthage compatible

About

ImagePickerSheetController is a component that replicates the custom photo action sheet in iMessage. It's very similar to UIAlertController which makes its usage simple and concise.
⚠️You can also find an iOS 10 version of this library here⚠️

Screenshot

Usage

ImagePickerSheetController is similar to UIAlertController in its usage.

Example

let controller = ImagePickerSheetController(mediaType: .ImageAndVideo)
controller.addAction(ImagePickerAction(title: NSLocalizedString("Take Photo Or Video", comment: "Action Title"), secondaryTitle: NSLocalizedString("Add comment", comment: "Action Title"), handler: { _ in
	presentImagePickerController(.Camera)
}, secondaryHandler: { _, numberOfPhotos in
	println("Comment \(numberOfPhotos) photos")
}))
controller.addAction(ImagePickerAction(title: NSLocalizedString("Photo Library", comment: "Action Title"), secondaryTitle: { NSString.localizedStringWithFormat(NSLocalizedString("ImagePickerSheet.button1.Send %lu Photo", comment: "Action Title"), $0) as String}, handler: { _ in
	presentImagePickerController(.PhotoLibrary)
}, secondaryHandler: { _, numberOfPhotos in
	println("Send \(controller.selectedImageAssets)")
}))
controller.addAction(ImagePickerAction(title: NSLocalizedString("Cancel", comment: "Action Title"), style: .Cancel, handler: { _ in
	println("Cancelled")
}))
            
presentViewController(controller, animated: true, completion: nil)

It's recommended to use stringsdict to easily translate plural forms in any language.

Installation

CocoaPods

pod "ImagePickerSheetController", "~> 0.9.1"

###Carthage

github "lbrndnr/ImagePickerSheetController" ~> 0.9.1

You should also add two new values to your app's Info.plist to tell the user why you need to access the Camera and Photo Library.

<key>NSCameraUsageDescription</key>
<string>Camera usage description</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo Library usage description</string>

Requirements

ImagePickerSheetController is written in Swift and links against Photos.framework. It therefore requires iOS 9.0 or later.

Author

I'm Laurin Brandner, I'm on Twitter.

License

ImagePickerSheetController is licensed under the MIT License.

主要指標

概覽
名稱與所有者lbrndnr/ImagePickerSheetController
主編程語言Swift
編程語言Swift (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2014-09-09 13:48:57
推送於2019-08-23 19:53:31
最后一次提交2019-01-03 21:47:53
發布數21
最新版本名稱0.9.3 (發布於 )
第一版名稱0.0.1 (發布於 2014-11-04 11:39:53)
用户参与
星數1.4k
關注者數35
派生數211
提交數367
已啟用問題?
問題數77
打開的問題數0
拉請求數15
打開的拉請求數1
關閉的拉請求數19
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?