2011-08-24 29 views
8

如何在iOS中使用iPad上的色輪,顏色選擇器或色調選擇器。iOS中的色輪或顏色選擇器

下面是一個類似於我想要的顏色選擇器的示例圖片。

enter image description here

@All在此先感謝。

+2

這是不是一個真正的色輪** **。 – Luke

+0

這是色調。對於Ipad。 – user891268

+0

這對我來說沒有任何意義。什麼是HUE? – Luke

回答

9

This post可以幫助你。選擇顏色的一種簡單方法是獲取您提供的圖像中像素的顏色。 也有顏色選擇器的全部來源。

+0

現在甚至不會編譯。 _RotatableBitmapRep無效符號 – mskw

+0

@mskw對不起,這是幾年前。 – Luke

2

找到另一個非常簡單的文章...帶有示例代碼here

2

我知道這個問題一直已經回答和接受,但所有這就是被這裏提到的樣子過時,過時的github上的項目。我發現RSColorPicker這是易於使用,並具有我一直在尋找的所有功能。最重要的是它沒有過時。

2

我以爲我會把我的顏色選擇器扔進戒指。我在我的應用程序You Doodle中使用它,我花了幾個星期的時間在應用程序中進行測試。它包含一個示例項目,向您展示如何開始使用它,並根據MIT許可證開源。它支持任何設備(iOS 6+),任何分辨率和縱向和橫向。收藏夾,最近,顏色色調,色輪和導入紋理,以及刪除和移動收藏夾到前面支持。

我試着將所有其他顏色選擇器的優點組合起來,並確保MIT許可證允許無障礙地集成到任何項目中。

Github上:https://github.com/jjxtra/DRColorPicker

截圖:

DRColorPicker iPhone DRColorPicker iPad DRColorPicker iPhone DRColorPicker iPad DRColorPicker iPhone DRColorPicker iPad

2

沒有錯其他答案。我只是分享另一個使用Swift創建的color picker

swift-colorwheel

+0

漂亮的顏色選擇器! –

0

我確實創造了一個色輪中戰平部門(_ RECT:的CGRect)。 See here.

那我的色輪: sector of color wheel

這種觀點基於代碼的下一行:

override func draw(_ rect: CGRect) { 
    guard let context = UIGraphicsGetCurrentContext() else { 
     return 
    } 

    // Choice width and x position of a rect where will be placed you picker 
    for x in stride(from: bounds.midX - bounds.height, to: bounds.midX + bounds.height, by: elementSize) { 

     // Choice height and y position of the rect 
     for y in stride(from: 0, to: rect.height, by: elementSize) { 

      // Select color for a point 
      context.setFillColor(colorFor(x: x, y: y)) 

      // Select color for the point with elementSize which we declare and init as class property 
      context.fill(CGRect(x: x, y: y, width: elementSize, height: elementSize)) 
     } 
    } 
}