Objective-C类型下转换



我正在尝试覆盖

- (void)makeWindowControllers;

这是它的代码:

NSStoryboard* const storyboard = [NSStoryboard storyboardWithName:@"Main" bundle:nil];
NSWindowController* const windowController = [storyboard instantiateControllerWithIdentifier:@"Document Window Controller"];

然后我想把用户通过Swift中的open...选择的图像添加到ViewController中,我只需要做:

(windowController.contentViewController as? ViewController)?.imageView?.image = openedImage

我怎么能在Objective-C中进行这种下转换呢?我真的很困惑,因为我在学习C的时候没有做太多的类型转换。谢谢。

[[((ViewController *)[windowController contentViewController]) imageView] setImage: openedImage];

最新更新