Giter Club home page Giter Club logo

dkimagepickercontroller's Introduction

DKImagePickerController

Build Status Version Status license MIT

Update for Xcode 6.4 with Swift 1.2

Description

New version! It's A Facebook style Image Picker Controller by Swift.

Requirements

  • iOS 8.0+
  • ARC

Installation

DKImagePickerController is available on Cocoapods. Simply add the following line to your podfile:

# For latest release in cocoapods
pod 'DKImagePickerController'

Getting Started

Initialization and presentation

let pickerController = DKImagePickerController()

pickerController.didCancelled = { () in
    println("didCancelled")
}

pickerController.didSelectedAssets = { [unowned self] (assets: [DKAsset]) in
    println("didSelectedAssets")
    println(assets)
}

self.presentViewController(pickerController, animated: true) {}

Customizing

/// The maximum count of assets which the user will be able to select.
public var maxSelectableCount = 999

/// The type of picker interface to be displayed by the controller.
public var assetType = DKImagePickerControllerAssetType.allAssets

/// Whether allows to select photos and videos at the same time.
public var allowMultipleType = true

/// The callback block is executed when user pressed the select button.
public var didSelectedAssets: ((assets: [DKAsset]) -> Void)?

/// The callback block is executed when user pressed the cancel button.
public var didCancelled: (() -> Void)?

/// It will have selected the specific assets.
public var defaultSelectedAssets: [DKAsset]? {
    didSet {
        if let defaultSelectedAssets = self.defaultSelectedAssets {
            for (index, asset) in enumerate(defaultSelectedAssets) {
                if asset.isFromCamera {
                    self.defaultSelectedAssets!.removeAtIndex(index)
                }
            }
            
            self.selectedAssets = defaultSelectedAssets
            self.updateDoneButtonTitle()
        }
    }
}

Localization

It has been supported languages so far:

  • en.lproj
  • zh-Hans.lproj

If you want to add new language, pull request or issue!

Soon to do

  • Simply to take a picture!
  • It can hide the camera.
  • Simple photo browser.

Any pull requests to be welcome!!!

dkimagepickercontroller's People

Contributors

zhangao0086 avatar

Watchers

Carabineiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.