我正在尝试将颜色选择器合并到我的应用程序中。我已将 KZColorPicker 库从https://github.com/alexrestrepo/KZColorPicker复制到我的项目中
问题是该库显然是在没有使用 ARC 的情况下创建的。我正在使用 ARC,所以我遇到了很多错误,然后我注释掉了所有出错的发布声明。
实例化“KZDefaultColorViewController”后,它将进入 ViewDidLoad 语句,但给我一个“EXC_BAD_ACCESS code=1”错误。有任何想法吗???
这是启动颜色选择器屏幕的 IBAction:
- (IBAction)selectColor1:(id)sender
{
DebugLog(@"Change Color 1 Intiated");
// Use this code to push to the color picker
KZDefaultColorViewController *pickerController = [self.storyboard instantiateViewControllerWithIdentifier:@"ColorViewController"];
pickerController.navigationItem.title = @"Choose Color 1";
[self.navigationController pushViewController:pickerController animated:YES];
}
然后它转到 KZDefaultColorViewController 的 ViewDidLoad 似乎我得到了 EXC_BAD_ACCESS 错误:
- (void)viewDidLoad {
[super viewDidLoad];
KZColorPicker *picker = [[KZColorPicker alloc] initWithFrame:self.view.frame];
picker.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
picker.selectedColor = self.selectedColor;
picker.oldColor = self.selectedColor;
[picker addTarget:self action:@selector(pickerChanged:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:picker];
}