hayashi311 / Color-Picker-for-iOS

Colorful: iOS color picker built with Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to initialize colorPicker.color

ljlin opened this issue · comments

I use Color-Picker-for-iOS by storyboard and do implement - (void)viewWillAppear:(BOOL)animated but it doesn't work.Every time I segue to the scene colorpickerview always show the default color(redcolor,the upper left corner of the square).

@implementation LLColorPickerController
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.colorPickerView.color = [UIColor blueColor];//self.color;
}

try 2.0

pod 'HRColorPicker', :git =>  'git@github.com:hayashi311/Color-Picker-for-iOS.git'

Hi, I couldn't get this to work either with the latest version. I set defaultColor to blue before pushing the view controller (instantiated from a storyboard).

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.colorPickerView.color = self.defaultColor;
}

I figured it out though, setting the following in either viewWillAppear or viewDidLoad:

self.colorPickerView.colorInfoView.color = self.defaultColor;
self.colorPickerView.colorMapView.color = self.defaultColor;
self.colorPickerView.brightnessSlider.color = self.defaultColor;