我正在使用下面的代码,我想将选定的颜色传递给另一个类,但它给了我以下警告并且不起作用:
从 uicolor strong 分配给 nsstring 的不兼容指针类型:
代码:
-(IBAction)showpickerview
{
NEOColorPickerViewController *controller = [[NEOColorPickerViewController alloc] init];
controller.delegate = self;
//controller.selectedColor = self.currentColor;
controller.title = @"Select Color";
UINavigationController* navVC = [[UINavigationController alloc] initWithRootViewController:controller];
[self presentViewController:navVC animated:YES completion:nil];
}
- (void)colorPickerViewController:(NEOColorPickerBaseViewController *)controller didSelectColor:(UIColor *)color
{
SecondClass *second = [[SecondClass alloc]init];
second.selectColor = color;
NSLog(@"selected color %@",second.selectColor);
//UIColor *color1 = color;
//const CGFloat *components = CGColorGetComponents(color.CGColor);
//second.selectColor = [NSString stringWithFormat:@"%f,%f,%f,%f", components[0], components[1], components[2], components[3]];
//NSLog(@"selected color %@",second.selectColor);
[controller dismissViewControllerAnimated:YES completion:nil];
}