Giter Club home page Giter Club logo

imagerow's Introduction

Build status Platform iOS Swift 4 compatible Carthage compatible CocoaPods compatible License: MIT

By Xmartlabs SRL.

Introduction

ImageRow is a Eureka custom row that allows us to take or choose a picture.

Usage

import ImageRow
import Eureka

class ViewController: FormViewController {

    override func viewDidLoad() {
        super.viewDidLoad()


        form +++ Section()
                <<< ImageRow() { row in
                    row.title = "Image Row 1"
                    row.sourceTypes = [.PhotoLibrary, .SavedPhotosAlbum]
                    row.clearAction = .yes(style: UIAlertAction.Style.destructive)
                }
             +++
                Section()
                <<< ImageRow() {
                    $0.title = "Image Row 2"
                    $0.sourceTypes = .PhotoLibrary
                    $0.clearAction = .no
                }
                .cellUpdate { cell, row in
                    cell.accessoryView?.layer.cornerRadius = 17
                    cell.accessoryView?.frame = CGRect(x: 0, y: 0, width: 34, height: 34)
                }
             +++
                 Section()
                    <<< ImageRow() {
                        $0.title = "Image Row 3"
                        $0.sourceTypes = [.PhotoLibrary, .SavedPhotosAlbum]
                        $0.clearAction = .yes(style: .default)
                    }
    }
}

You must add the NSPhotoLibraryUsageDescription and NSCameraUsageDescription keys to your info.plist to use the Photo Library and camera. For more information, take a look at apple documentation.

Requirements

  • iOS 9.3+
  • Xcode 10.2+
  • Eureka ~> 5.0

Getting involved

  • If you want to contribute please feel free to submit pull requests.
  • If you have a feature request please open an issue.
  • If you found a bug or need help please check older issues, FAQ before submitting an issue..

Before contribute check the CONTRIBUTING file for more info.

If you use ImageRow in your app We would love to hear about it! Drop us a line on twitter.

Examples

Follow these 3 steps to run Example project: Clone ImageRow repository, run carthage update from project root folder, open ImageRow workspace and run the Example project.

You can also experiment and learn with the ImageRow Playground which is contained in ImageRow.workspace.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

To install ImageRow, simply add the following line to your Podfile:

pod 'ImageRow', '~> 4.1'

Carthage

Carthage is a simple, decentralized dependency manager for Cocoa.

To install ImageRow, simply add the following line to your Cartfile:

github "EurekaCommunity/ImageRow" ~> 4.1

Customization

ImageRow has 5 properties to customize:

  • sourceTypes which allows us to specify the source of the picture. It could be .PhotoLibrary, .Camera, .SavedPhotosAlbum, or any combination of the previous values since sourceTypes property type is ImageRowSourceTypes which conforms to OptionSet.
  • clearAction let's us add a clear action sheet option and configure its style. Possible values are: .no or .yes(style: UIAlertActionStyle). Notice that .yes value requires we pass a UIAlertActionStyle style.
  • allowEditor tells the ImagePickerController to use the standard system image editor after a Image is selected. Possible values are: true or false. The default value for this property is false.
  • useEditedImage tells the ImageRow to use the edited Image from the editor instead of the original one. Possible values are: true or false. The default value for this property is false.
  • userPickerInfo this property holds the info properties of the ImagePickerController after a edited Image is selected, this can be used to further customization or information usage of the selected image. By default this property is nil.

To localize the Actionsheet strings just add the keys "Take photo", "Photo Library", "Saved Photos", "Cancel", "Clear Photo" to your Localizable.strings file

Author

Change Log

This can be found in the CHANGELOG.md file.

imagerow's People

Contributors

andrewbennet avatar damozhang avatar funkenstrahlen avatar gruenekampfente avatar jamieamazon avatar jasonnam avatar joaodforce avatar kamerc avatar mats-claassen avatar mtnbarreto avatar oliver530 avatar robmaceachern avatar rodriar avatar ryan-w avatar thomas4bitcraft avatar tladesignz avatar wouterw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imagerow's Issues

ImageEditing is not working

After
pod 'Eureka'
pod 'ImageRow', '~> 3.0'

I got
....
Using Eureka (4.3.0)
Using ImageRow (3.1.0)
....

and image editing functionality such as cropping is not working

Show a placeholder image when value is nil?

I observed that when the value is nil, the row just looks like a regular LabelRow, with only a text label. The user might not understand that they should tap on the row to select an image. I could just append something like "(Tap to add image)" to the title, but IMO that's not very pretty.

My suggestion is that to show a placeholder image, something like this

icons8-ios_application_placeholder_filled

when value is nil.

image not show after selected

Image not show after selected. Confirmed already grant user photo library access.

  • Environment: ImageRow 3.0.0 , Swift 4, Xcode 9.3 and iOS 10.0 version

<<< ImageRow() { row in
//row.title = "Image Row 1"
row.tag = "Image"
row.sourceTypes = .PhotoLibrary
row.clearAction = .no
}

2018-04-22 08:40:52.702612-0300 smartpei[74597:3132954] TIC Read Status [1:0x0]: 1:57
Access is granted by user
2018-04-22 08:40:58.334406-0300 smartpei[74597:3132835] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/zhangchongyu/Library/Developer/CoreSimulator/Devices/EF43E0F4-77AE-4F36-B5ED-14E7918AF488/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2018-04-22 08:40:58.335297-0300 smartpei[74597:3132835] [MC] Reading from private effective user settings.
2018-04-22 08:41:15.333641-0300 smartpei[74597:3133254] [discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}

Option "noValueDisplayText" does not work

There's an issue with Eureka 4.0.1 used with iOS 11 and the latest Xcode 9.1.
I set noValueDisplayText setting to ImageRow and I chose image, but noValueDisplayText did not disappear.

Are Eureka selectors are been obfuscated?

Hello

I'm asking this question because I got a rejection on the AppStore.

And the Apple Review Team told me to try to find some obfuscated selectors that are causing the rejection. the give me the following message.

Guideline 2.3.1 - Performance
We discovered that your app contains hidden features. Specifically, we found that this app or a framework embedded within it contain obfuscated selectors. These selectors contain names like 'SDK_v2RmqtE8QRceHjTQwD3v37oOqso61QFlOFHEk:SDK_e5L7s2FNTdu8Ttv1lRdrCWv:' and 'SDK_t0deadLdPKsU8FJPMjmJ:'. We recommend that you use the "nm" tool or the command line tools "strings" or "otool -ov" to find the entities that are causing this rejection. Additionally, you may wish to contact Apple Developer Technical Support for assistance.

Using the tools that Apple Recommend me, I see All the other Frameworks selectors in my App Except the Eureka ones.

Thanks for the help

Get multiple imageRows into an imageArray.

I am trying to get the image from the image row and put it into an array. I am using the Eureka multivalued row so I can have multiple photos. I then use the form.values to put everything into a dictionary. The tag for each imageRow starts with "Image" I am trying to take the photos and put them into a photos array like this:

if key.hasPrefix("Image") {
newReport.images?.append((value)! as! UIImage)
}

I try to print out the array just to see if my images are in there and the array shows as nil. Am I supposed to do anything different to get the image from an imageRow? Am I correct to assume it should return a UIImage for each row?

Camera

Hi, I am using Eureka and ImageRow as an addition to it. The master branch is installed with cocoapods. However I have strange thing, maybe it is not strange, I add .Camera to row.sourceTypes but there is no option about Camera in the ActionSheet. Any thoughts?

<<< ImageRow() { row in
                row.title = "Picture"
                row.sourceTypes = [.PhotoLibrary, .SavedPhotosAlbum, .Camera]
                row.clearAction = .yes(style: .default)
            }
 

Multiple selection

Does this library support multiply value of the image. Where i can select multiple image and add to it to the image view just like on the example?

VideoRow

So I am currently working on a videoRow and I am sort of stuck. i have leveraged some of the code from the image row as can be seen below.

[import Foundation
import Eureka

public struct VideoRowSourceTypes : OptionSet {
    
    public let rawValue: Int
    public var imagePickerControllerSourceTypeRawValue: Int { return self.rawValue >> 1 }
    
    public init(rawValue: Int) { self.rawValue = rawValue }
    init(_ sourceType: UIImagePickerController.SourceType) { self.init(rawValue: 1 << sourceType.rawValue) }
    
    public static let PhotoLibrary = VideoRowSourceTypes(.photoLibrary)
    public static let All: VideoRowSourceTypes = [PhotoLibrary]
    
}

extension VideoRowSourceTypes {
    
    // MARK: Helpers
    
    var localizedString: String {
        switch self {
        case VideoRowSourceTypes.PhotoLibrary:
            return "Photo Library"
        default:
            return ""
        }
    }
}

public enum VideoClearAction {
    case no
    case yes(style: UIAlertAction.Style)
}



//MARK: Row

open class VideoRow<Cell: CellType>: OptionsRow<Cell>, PresenterRowType where Cell: BaseCell, Cell.Value == UIImage {
    public typealias PresenterRow = ImagePickerController

    /// Defines how the view controller will be presented, pushed, etc.
    open var presentationMode: PresentationMode<PresenterRow>?
    
    /// Will be called before the presentation occurs.
    open var onPresentCallback: ((FormViewController, PresenterRow) -> Void)?
    
    open var sourceTypes: VideoRowSourceTypes = []

    open internal(set) var videoURL: URL?
    open var clearAction = VideoClearAction.yes(style: .destructive)
    
    private var _sourceType = UIImagePickerController.SourceType.photoLibrary
    
    public required init(tag: String?) {
        sourceTypes = .All
        super.init(tag: tag)
        presentationMode = .presentModally(controllerProvider: ControllerProvider.callback { return ImagePickerController() }, onDismiss: { [weak self] vc in
            self?.select()
            vc.dismiss(animated: true)
        })
        self.displayValueFor = nil
        
    }
    
    
    // copy over the existing logic from the SelectorRow
    func displayImagePickerController(_ sourceType: UIImagePickerController.SourceType) {
        if let presentationMode = presentationMode, !isDisabled {
            if let controller = presentationMode.makeController(){
                controller.row = self
                controller.sourceType = sourceType
                onPresentCallback?(cell.formViewController()!, controller)
                presentationMode.present(controller, row: self, presentingController: cell.formViewController()!)
            }
            else{
                _sourceType = sourceType
                presentationMode.present(nil, row: self, presentingController: cell.formViewController()!)
            }
        }
    }
    
    
    /// Extends `didSelect` method
    /// Selecting the Image Row cell will open a popup to choose where to source the photo from,
    /// based on the `sourceTypes` configured and the available sources.
    open override func customDidSelect() {
        guard !isDisabled else {
            super.customDidSelect()
            return
        }
        deselect()
        
        var availableSources: VideoRowSourceTypes = []
        
        if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) {
            let _ = availableSources.insert(.PhotoLibrary)
        }
        
        sourceTypes.formIntersection(availableSources)
        
        if sourceTypes.isEmpty {
            super.customDidSelect()
            guard let presentationMode = presentationMode else { return }
            if let controller = presentationMode.makeController() {
                controller.row = self
                controller.title = selectorTitle ?? controller.title
                onPresentCallback?(cell.formViewController()!, controller)
                presentationMode.present(controller, row: self, presentingController: self.cell.formViewController()!)
            } else {
                presentationMode.present(nil, row: self, presentingController: self.cell.formViewController()!)
            }
            return
        }
        
        // Now that we know the number of sources aren't empty, let the user select the source
        let sourceActionSheet = UIAlertController(title: nil, message: selectorTitle, preferredStyle: .actionSheet)
        guard let tableView = cell.formViewController()?.tableView  else { fatalError() }
        if let popView = sourceActionSheet.popoverPresentationController {
            popView.sourceView = tableView
            popView.sourceRect = tableView.convert(cell.accessoryView?.frame ?? cell.contentView.frame, from: cell)
        }
        createOptionsForAlertController(sourceActionSheet)
        if case .yes(let style) = clearAction, value != nil {
            let clearPhotoOption = UIAlertAction(title: NSLocalizedString("Clear Photo", comment: ""), style: style, handler: { [weak self] _ in
                self?.value = nil
                self?.videoURL = nil
                self?.updateCell()
            })
            sourceActionSheet.addAction(clearPhotoOption)
        }
        if sourceActionSheet.actions.count == 1 {
            if let imagePickerSourceType = UIImagePickerController.SourceType(rawValue: sourceTypes.imagePickerControllerSourceTypeRawValue) {
                displayImagePickerController(imagePickerSourceType)
            }
        } else {
            let cancelOption = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler:nil)
            sourceActionSheet.addAction(cancelOption)
            if let presentingViewController = cell.formViewController() {
                presentingViewController.present(sourceActionSheet, animated: true)
            }
        }
    }
    
    
    
    
    
    
    }

extension VideoRow {
    //MARK: Helpers

    func createOptionsForAlertController(_ alertController: UIAlertController) {
        createOptionForAlertController(alertController, sourceType: .PhotoLibrary)
    }
    
    
    func createOptionForAlertController(_ alertController: UIAlertController, sourceType: VideoRowSourceTypes) {
        guard let pickerSourceType = UIImagePickerController.SourceType(rawValue: sourceType.imagePickerControllerSourceTypeRawValue), sourceTypes.contains(sourceType) else { return }
        let option = UIAlertAction(title: NSLocalizedString(sourceType.localizedString, comment: ""), style: .default, handler: { [weak self] _ in
            self?.displayImagePickerController(pickerSourceType)
        })
        alertController.addAction(option)
    }
}
    

/// A selector row where the user can pick an image
public final class _VideoRow : VideoRow<PushSelectorCell<UIImage>>, RowType {
    public required init(tag: String?) {
        super.init(tag: tag)
    }
}

This is my imagepickercontroller

import Foundation
import Eureka
import MobileCoreServices

/// Selector Controller used to pick an image
open class ImagePickerController : UIImagePickerController, TypedRowControllerType, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
    
    /// The row that pushed or presented this controller
    public var row: RowOf<UIImage>!
    
    /// A closure to be called when the controller disappears.
    public var onDismissCallback : ((UIViewController) -> ())?
    
    open override func viewDidLoad() {
        super.viewDidLoad()
        delegate = self
        mediaTypes = [kUTTypeMovie as String]
    }
    
//    open func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
//        // The info dictionary may contain multiple representations of the image. You want to use the original.
//        guard let selectedImage = info[.originalImage] as? UIImage else {
//            fatalError("Expected a dictionary containing an image, but was provided the following: \(info)")
//        }
//
////        (row as? _VideoRow)?.videoURL = info[UIImagePickerController.INF] as? URL
//
//        onDismissCallback?(self)
//    }
    
    public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
        guard let videoURL = info[UIImagePickerControllerMediaURL] as? URL else {
            return
        }
        
        (row as? _VideoRow)?.videoURL = videoURL
        onDismissCallback?(self)
    }
    
    open func imagePickerControllerDidCancel(_ picker: UIImagePickerController){
        onDismissCallback?(self)
    }
}

Im just trying to figure out

  1. Am I on the right track?
  2. The ImageRow returns a UIImage what would be the return for the videoRow...the videoURL? if so how would i change the value?
  3. How would i change the value but still have a thumbnail for the video appear to represent selected video?

Cell's Accessory Type is not shown properly

Hello, I am using Xcode 11.3, ImageRow 4.0, Swift 5.

I have a form with one section and inside it there is an ImageRow:

ImageRow() { row in
            row.title = "Image"
            row.sourceTypes = .All
            row.clearAction = .yes(style: .destructive)
            row.tag = "TestImage"
        }.cellUpdate({ (cell, row) in
            cell.accessoryType = .disclosureIndicator
        })

I modify the cell's accessoryType to .disclosureIndicator for TextRow, DateRow, TimeRow successfully (I modified just to test it) but only ImageRow does not show .disclosureIndicator properly when running the app. Thank you in advance.

Xcode 10 and Swift 4.2

Issues when we build ImageRow with Xcode 10 Beta 6 and Swift 4.2

image

I know that Xcode 10 still in beta but the date of the Keynote is approaching quickly and if we want our application to be ready when iOS 12 will come out the components we use are ready a little before

Disabled property not working

Hi,
Thanks for great library, It seems this component doesn't respects disabled property at all. If you set the disabled to true you can still choose picture by clicking on it. It would be nice if there was a greyish kind of color too when disabled.

Thanks in advance

How to upload the image from a ImageRow

Hi, I'm trying to upload a photo from a ImageRow but I don't know where to find the image data.
I tried searching the form.values() but I'm not sure I can use what is there.

import Eureka
import ImageRow

class ImageUploadViewController: FormViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        form +++ Section("PictureSection")
            <<< ImageRow("PictureRow"){
                $0.title = "picture"
            }
    }
    
    @IBAction func upload_button(_ sender: Any) {
        let values = form.values() 
        let image = ... 
        upload(image) //some fictional function
    }
}

Thanks in advance.

How to display the image other than as an accessory view?

I wanted to check if the imageRow can be customized for the below 2 scenarios. If so, looking to understand how to customize it so that I can take advantage of the ImagePickerController that comes with it.

  1. Profile image that is displayed in the center of a cell
    Here is what I tried: I figured out how to do sub-class a Cell and Row and use a cellProvider to call a .xib file that has imageview in center, however, missing how to create a "image picker" feature.

  2. An collection view within the imageRow that contains one cell per image added from image source (camera/photo library) and a default "+" imageview collectionview cell that when clicked presents the ImagePickerController. This is for ability to show multiple pictures added horizontally and be able to clear an added picture by tap on an existing picture

Thanks in advance

UIImagePickerController not localized

On an iPhone localized in German, I use ImageRow with a Localizable.string file as described in README.md, containing translations for all English UI texts. The actionsheet is correctly shown in German, but when I enter camera mode, I see "PHOTO", "Cancel", "Retake", "Use Photo" in English. In photo library / saved photos, heading and section titles are German, but the "Cancel" button isn't.

img_2950
img_2951
img_2944
img_2945

Xcode crashes as soon as i call ImageRow

xcode gives abort trap 6 error as soon as i call imagerow in my form but it working fine in my other project.

*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
could not deserialize type for '_': could not deserialize type for 'userPickerInfo': declaration is not a nominal type
Cross-reference to module 'UIKit'

1.	While running pass #219 SILModuleTransform "MandatoryInlining".
2.	While deserializing SIL vtable for 'ImageRow' in module 'ImageRow'
error: Abort trap: 6

ImageRow.podspec needs to update

Eureka moves to 3.1.0 while ImageRow(2.0.0) still depends on 3.0 tightly.
Suggestion to revise

s.dependency 'Eureka', '> 3.0'

ImageRow Alignment

Guys, I'm trying to align the image of my ImageRow in the center. Does anyone know how to do this?

Below is my code

<<< ImageRow() {
        $0.sourceTypes = [.Camera, .PhotoLibrary]
        $0.clearAction = .yes(style: UIAlertActionStyle.destructive)
        $0.placeholderImage = #imageLiteral(resourceName: "account-image")
        }.cellUpdate { cell, row in
                 cell.height = ({return 124})
                 cell.detailTextLabel?.textAlignment = .center
                 cell.accessoryView?.frame = CGRect(x: 0, y: 0, width: 106, height: 106)
                 cell.accessoryView?.layer.cornerRadius = (cell.accessoryView?.frame.height)!/2
}

https://imgur.com/a/Kvgr5

Thank you

documentation

Hello,

Just want to let you know it would be good to include in the README that NSCameraUsageDescription is necessary in Info.plist when trying to work with Camera.

For rookies like me on iOS and Swift development would be a good information :)

Thanks!

Camera as source type is NOT working

I am using Eureka version 5.0.0 and ImageRow version 4.0.0 when I add this to my form

<<< ImageRow(FormItems.image) { row in
row.title = "Item Image"
row.sourceTypes = [.PhotoLibrary, .Camera]
row.clearAction = .yes(style: UIAlertAction.Style.destructive)
}

When I click on "Item Image" it doesn't present me with a menu of either photo library or using my camera it just takes me directly into my photo library? Also when I remove .PhotoLibrary from sourceTypes and just leave .Camera it doesn't work. I cannot get my camera to show up as an option. In my plist I have camera access granted as other screens in my app are already integrating with the camera just fine but not using ImageRow to do so.

Before submitting issues ...

  • Make sure you are using ImageRow's latest release or master branch version.
  • Make sure your Xcode version is the latest stable one.
  • Check if the issue was already reported or fixed. We add labels to each issue in order to easily find related issues. If you found a match add a brief comment "I have the same problem" or "+1".

When submitting issues, please provide the following information to help maintainers to fix the problem faster:

  • Environment: ImageRow, Xcode and iOS version you are using.
  • In case of reporting errors, provide Xcode console output of stack trace or code compilation error.
  • Any other additional detail such as your eureka form/section/row code that you think it would be useful to understand and solve the problem.

Cannot install when using Eureka 5

The latest version of ImageRow doesn't support the latest version of Eureka (5). This will require updating to Xcode 10.2 and Swift 5.

Companion pull request: #62

pushViewController corrupts the views in the sample app

Hi Martin, I modified the imageRow for a WebImageRow framework so that I can have two images in a Row that we can populate from the photo library. However if the form view is pushed atop the root view, then when setting the photo, the image gets corrupted and the whole view displays the selected photo! Can you please have a look to see if the issue is with the base FormViewController?

Thanks so much for your help
WebImageRow.zip

Crashing after 20-30 pictures

Hi,
I'm really happy with this ImageRow functionality but the app that i'm working on is used during whole day and after creating 20-30 images it is crashing. When I try to debug it in Xcode nothing is shown, only message that says "Connection is lost"

Any suggestions what could be the problem? Thanks in advance.

Best regards,
Daniel Neykov

How should I set CustomPickerController to be used for my custom cell

This is code of my CustomPickerController

open class CustomPickerController: UIImagePickerController, TypedRowControllerType, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
    
    /// The row that pushed or presented this controller
    public var row: RowOf<UIImage>!
    
    /// A closure to be called when the controller disappears
    public var onDismissCallback : ((UIViewController) -> ())?
    
    open override func viewDidLoad() {
        super.viewDidLoad()
        
        delegate = self
        
        // Allow edition
        allowsEditing = true
    }
    
    open func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
        (row as? MyImageRow)?.imageURL = info[UIImagePickerControllerReferenceURL] as? URL
        //row.value = info[UIImagePickerControllerOriginalImage] as? UIImage
        row.value = info[UIImagePickerControllerEditedImage] as? UIImage
        onDismissCallback?(self)
    }
    
    open func imagePickerControllerDidCancel(_ picker: UIImagePickerController){
        onDismissCallback?(self)
    }
}

How can I set it for my custom ImageRow?

Support of the system language :)

Hey,

It could be awesome to support many languages, or giving the possibility to change the text to print.

If not, I will try to take a look this week :)

Cheers

ImageRow.swift:72:71: Generic type 'SelectorRow' specialized with too many type parameters (got 2, but expected 1)

I am trying to import the Image row and use Eureka 3.1.0. I am getting a strange error in the below specified line:
open class _ImageRow<VCType: TypedRowControllerType, Cell: CellType>: SelectorRow<Cell, VCType>, ImageRowProtocol where VCType: UIImagePickerController, VCType.RowValue == UIImage, Cell: BaseCell, Cell: TypedCellType, Cell.Value == UIImage

Error is: ..../ImageRow/ImageRow.swift:72:71: Generic type 'SelectorRow' specialized with too many type parameters (got 2, but expected 1)

can you please help to resolve this issue?

Custom Cell Class

Hello guys,

Thanks for such a great component. But it's a little bit too complex to grasp it quickly. Can you help with custom cell class, where I can have imageView added to contentView, and not sticked to accessoryView position.

I ended up with something like this

protocol ImagePickerCellType: class {
	var imagePickerView: UIImageView! { get set }
}

public class ImagePickerCell: Cell<UIImage>, CellType, ImagePickerCellType {

	internal(set) var imagePickerView: UIImageView!

	public override func setup() {
		super.setup()
		imagePickerView = UIImageView(frame: .init(x: 200, y: 0, width: 44.0, height: 44.0))
		imagePickerView.contentMode = .scaleAspectFill
		imagePickerView.clipsToBounds = true
		contentView.addSubview(imagePickerView)
	}

	public override func update() {
		super.update()
		accessoryType = .disclosureIndicator
		editingAccessoryType = accessoryType
		selectionStyle = row.isDisabled ? .none : .default
	}
}

Therefore I don't know how to setup Cell constraint in Row definition. I tried to add Cell: ImagePickerCellType to open class _ImageRow<Cell: CellType>: SelectorRow<Cell, ImagePickerController> where Cell: BaseCell, Cell.Value == UIImage {, but I got Generic class cannot be declared because its generic requirement uses an internal type.

As temporary solution I updated row as follow

open override func customUpdateCell() {
        super.customUpdateCell()
        cell.accessoryType = .none

		guard let cell = cell as? ImagePickerCellType else { return }

        if let image = self.value {
            cell.imagePickerView.image = image
        } else {
            cell.imagePickerView.image = nil
        }
    }

How can we set Front Facing Camera for imageRow?

<<< ImageRow("profile")
$0.title = " Profile Picture"
$0.sourceTypes = [.Camera, .PhotoLibrary, .SavedPhotosAlbum]
$0.clearAction = .no
}
.onPresent({ (formVC, imagePickerVC) in
imagePickerVC.cameraDevice = .front
})

This always looks for .Camera ONLY. If user chooses PhotoLibrary OR saved album, app errors with
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type must be UIImagePickerControllerSourceTypeCamera'

On iOS 13, allowEditor param does not work

  • Environment: ImageRow, Xcode 10.1, 10.3, and 11.2 (tried all, just in case).
  • On iOS 13 - allowEditor does not work, and thus, when the image is picked, nothing is returned because we search for the UIImagePickerController.InfoKey.editedImage which is nil.

Most likely - this is due to a difference in how iOS 13+ works with UIImagePickerController. We set the allowsediting flag on the image picker in viewDidLoad of the subclass, which is likely too late. We can fix it by setting this value when we init the controller instead.

 presentationMode = .presentModally(controllerProvider: ControllerProvider.callback {
        let controller = ImagePickerController()
        controller.allowsEditing = self.allowEditor
        return controller
        }, onDismiss: { [weak self] vc in
        self?.select()
      vc.dismiss(animated: true)
    })

Change status bar color

Is there any way to change the current status bar style to default? Looks like the image picker is using the status bar style that my app is using, even though this doesn't look nice.

Thanks!

simulator screen shot 10 lug 2017 12 00 15

Install fail with Eureka 5.0

I keep getting this error.

[!] CocoaPods could not find compatible versions for pod "ImageRow":
In Podfile:
ImageRow (~> 4.0.0)

None of your spec sources contain a spec satisfying the dependency: ImageRow (~> 4.0.0).

You have either:

  • out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
  • mistyped the name or version.
  • not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, pod repo update does not happen on pod install by default.

Constraint issue

Hello,

I'm using ImageRow 4.0, Xcode 10.2.1 with Swift 5.
I have a simple controller with only one ImageRow cell.
When I tapped on the cell, the picker is showing but I have a constraint issue:

[LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600001ad7a70 UIView:0x7fb050c97960.width == - 16   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600001ad7a70 UIView:0x7fb050c97960.width == - 16   (active)>

Here the code:

form
        +++ Section("sectionId")
            <<< ImageRow("id") { row in
                row.title = "Title"
                row.sourceTypes = [.All]
                row.clearAction = .yes(style: UIAlertAction.Style.destructive)
            }

Add custom camera to Image Picker Controller

  • Environment: ImageRow
  • Xcode: 9.2 (9C40b)

I've created a customer Camera Controller that extends from UIViewController, but I don't how to set this custom camera when I choose a .Camera Source Type using the ImageRow What should I do for that?

Labels: Help Required

How can we set Front Facing Camera for imageRow?

Before submitting issues ...

  • Make sure you are using ImageRow's latest release or master branch version.
  • Make sure your Xcode version is the latest stable one.
  • Check if the issue was already reported or fixed. We add labels to each issue in order to easily find related issues. If you found a match add a brief comment "I have the same problem" or "+1".

When submitting issues, please provide the following information to help maintainers to fix the problem faster:

  • Environment: ImageRow, Xcode and iOS version you are using.
  • In case of reporting errors, provide Xcode console output of stack trace or code compilation error.
  • Any other additional detail such as your eureka form/section/row code that you think it would be useful to understand and solve the problem.

Image not changing

Hi I have a swift 3 project and I'm trying to use ImageRow but image at row does not change when I select a picture in photo library.
Besides this The error: "[Generic] Creating an image format with an unknown type is an error" is showing up. I have tryed the solution presented in issue #7 but not worked for me.

my code is:

<<< ImageRow(){ row in
   row.title = "Challenge Image"
   row.sourceTypes = [.PhotoLibrary, .SavedPhotosAlbum, .Camera]
   row.clearAction = .yes(style: UIAlertActionStyle.destructive)
   if nil != self.myobj.img {
      row.value = UIImage(named: self.myobj.img!)
   } else {
      row.value = UIImage(named: "default-img")
   }
}

Image placement

Hey there are certain cases where the image selected slides all the way over to the left for some odd reason. Anybody have any idea why?

Add Eureka 4.0 Support in CocoaPods

Now, I get this error while doing pod install

[!] Unable to satisfy the following requirements:

- `Eureka (~> 4.0.0)` required by `Podfile`
- `Eureka (= 3.0)` required by `ImageRow (2.0.0)`

Cocoapods failed to install ImageRow 4.0 (already have Eureka 5.0)

I tried to install the latest ImageRow with pod 'ImageRow', '~> 4.0' in installation instruction and failed.

Below is the error message:

[!] CocoaPods could not find compatible versions for pod "ImageRow":
  In Podfile:
    ImageRow (~> 4.0)

None of your spec sources contain a spec satisfying the dependency: `ImageRow (~> 4.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

For now if anyone faces the same issue, you can use pod 'ImageRow', :git => 'https://github.com/EurekaCommunity/ImageRow.git', which works for me.

Creating an image format with an unknown type is an error

Hi,
I have this weird problem when selecting an image from the Photo Library
[Generic] Creating an image format with an unknown type is an error

  • My simplified code :
           +++ Section() { section in
                let header = createHeader(label: "Pictures or it didn't happend")
                section.header = header
                section.footer = createFooter()
            }
            <<< ImageRow() { row in
                row.tag = "image1"
                row.title = "Image 1"
                row.sourceTypes = .PhotoLibrary
                row.clearAction = .yes(style: UIAlertActionStyle.destructive)
                row.add(rule: RuleRequired())
                row.validationOptions = .validatesOnChange
            }
  • Environment: Eureka : 2.0.0-beta.1, ImageRow: 1.0, Xcode : 8.2.1 (8C1002), iOS: 10

Thanks for your help,
Sahbi

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.