BRNImagePickerSheetiOS 图片选择器

联合创作 · 2023-09-26 08:23

BRNImagePickerSheet是一款模仿iOS8's iMessage的图片选择器。在选项列表视图中可以滚动显示待选图片。 

示例代码:

let placeholder = BRNImagePickerSheet.selectedPhotoCountPlaceholder
var sheet = BRNImagePickerSheet()
sheet.addButtonWithTitle("Take Photo Or Video", singularSecondaryTitle: "Add Comment", pluralSecondaryTitle: nil)
sheet.addButtonWithTitle("Photo Library", singularSecondaryTitle: "Send \(placeholder) Photo", pluralSecondaryTitle: "Send \(placeholder) Photos")
sheet.delegate = self
sheet.showInView(self.view)

func imagePickerSheet(imagePickerSheet: BRNImagePickerSheet, willDismissWithButtonIndex buttonIndex: Int) {
    if buttonIndex != imagePickerSheet.cancelButtonIndex {
        if imagePickerSheet.showsSecondaryTitles {
            println(imagePickerSheet.selectedPhotos)
        }
    else {
        let controller = UIImagePickerController()
        controller.delegate = self
        controller.sourceType = (buttonIndex == 2) ? .PhotoLibrary : .Camera
        self.presentViewController(controller, animated: true, completion: nil)
        }
    }
}

浏览 8
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报