Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returned color is always 100% transparent #1

Closed
pronebird opened this issue Apr 26, 2015 · 2 comments
Closed

Returned color is always 100% transparent #1

pronebird opened this issue Apr 26, 2015 · 2 comments
Labels

Comments

@pronebird
Copy link

Demo works though.

- (IBAction)changeColor:(id)sender {
    MSColorSelectionViewController *controller = [[MSColorSelectionViewController alloc] init];
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller];

    UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done", ) style:UIBarButtonItemStyleDone target:self action:@selector(dismissColorPicker:)];
    controller.navigationItem.rightBarButtonItem = doneBtn;

    controller.delegate = self;
    controller.color = self.view.tintColor;

    [self presentViewController:navigationController animated:YES completion:nil];
}

- (void)dismissColorPicker:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)colorViewController:(MSColorSelectionViewController *)colorViewCntroller didChangeColor:(UIColor *)color {
    self.view.window.tintColor = color;
    colorViewCntroller.view.window.tintColor = color;
}
@pronebird
Copy link
Author

If you look at the setColor setter, it proxies color value to subview which is not created yet. Your demo works because you force viewDidLoad by using .view property of color selection controller.

It would make sense to retain the initial color and pass it to subview in viewDidLoad.

@sgl0v sgl0v added the bug label Apr 29, 2015
sgl0v added a commit that referenced this issue Apr 29, 2015
@sgl0v
Copy link
Owner

sgl0v commented Apr 29, 2015

Fixed this issue in version 0.2.1 . In the end I decided to force a view creation in setColor method.

@sgl0v sgl0v closed this as completed Apr 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants