我知道我可以双击一个 IKImageView 并调出编辑面板。而在 Objective CI 中可以做到这一点
- (IBAction)editPanel:(id)sender {
IKImageEditPanel *editor = [IKImageEditPanel sharedImageEditPanel];
[editor setFrameOrigin:NSMakePoint(400,200)];
[editor setDataSource:imageView]; // Here imageView is your IKImageView.
[editor makeKeyAndOrderFront:nil];
}
但是,当我尝试快速设置数据源时,我收到一条错误消息,提示我无法分配这种类型的 IKImageView!到 IKImageEditPanelDataSource 类型的值!
这是我的代码:
@IBAction func adjustments(sender: NSToolbarItem) {
let editor = IKImageEditPanel.sharedImageEditPanel()
editor.setFrameOrigin(NSPoint(x: 400, y: 200))
editor.dataSource = imageView //Error on this line
editor.makeKeyAndOrderFront(nil)
}