B4i Library [class][custom view] Color Picker

Discussion in 'iOS Libraries' started by Erel, Feb 12, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    [​IMG]

    Wrapper for: https://github.com/johankasperi/SwiftHSVColorPicker

    It is implemented as a custom view. The native library is accessed with NativeObject.

    You need to add these two lines to the main module:
    Code:
    #AdditionalLib: ColorPicker.framework.swift.3
    #MinVersion: 8
    Note that the color picker is not resizable. The size will be set based on the custom view initial size.

    If you are using a local Mac then you need to download and copy the framework to the Mac Libs folder.
     

    Attached Files:

    Last edited: Feb 12, 2017
  2. tufanv

    tufanv Expert Licensed User

    I have a question. Does
    ColorPicker.framework.swift.3 created by you according to b4i or you just put the framework from github and use nativeobject to use this ?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    I compiled the open source project as a framework and then used NativeObject to access the API.
     
    tufanv likes this.
  4. ilan

    ilan Expert Licensed User

    hi i am trying to use this color picker and i am getting an error:

     
  5. Erel

    Erel Administrator Staff Member Licensed User

    It will not work on the simulator. For now all swift libraries are not compatible with the simulator.
     
  6. kstainsb

    kstainsb Member Licensed User

    Hello, is it possible to set the inital color of the colorpicker when it first opens? I can't work out how to do that.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    [​IMG]
     
    kstainsb likes this.
  8. kstainsb

    kstainsb Member Licensed User

    Sorry, yes I meant via code - it doesn't seem to have a settable property to set the color in code. For example when I am changing the color of something, I want to set the color to an existing color first.
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Add this sub to the class code:
    Code:
    Public Sub SetInitialColor(clr As Int)
       noColorPicker.RunMethod(
    "setViewColor:"Array(noColorPicker.ColorToUIColor(clr)))
    End Sub
     
    kstainsb likes this.
  10. schimanski

    schimanski Well-Known Member Licensed User

    When changing the screen-orientation, the ColorPicker doesn't resize with the following code:

    Code:
    Private Sub pageColorPicker_Resize(Width As Int, Height As Int)
       ColorPicker1.GetBase.SetLayoutAnimated(
    0000, Width, Height)
    End Sub
    Is there another solution?
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    The view itself is not resizable. The only way to resize it is to remove the current view and create a new one.

    You can create a layout file with only the ColorPicker and then load it to a panel when the panel is resized.
     
  12. schimanski

    schimanski Well-Known Member Licensed User

Loading...