Я использую следующий код, и я хочу передать выбранный цвет на другой класс, но это дает мне следующее предупреждение и не работает:как передать объект UIColor из одного класса в другой класс
несовместимые типы указателей, относящие NSString из UIColor сильным:
код:
-(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];
}
Какое предупреждение? – Peres
как вы вызываете colorPickerViewController ?? –
несовместимые типы указателей, назначающие nsstring из uicolor strong –