我正在尝试覆盖
- (void)makeWindowControllers;
这是它的代码:
NSStoryboard* const storyboard = [NSStoryboard storyboardWithName:@"Main" bundle:nil];
NSWindowController* const windowController = [storyboard instantiateControllerWithIdentifier:@"Document Window Controller"];
然后我想将图像添加到用户通过Swift中的ViewController
选择的open...
中,我只需做一下:
(windowController.contentViewController as? ViewController)?.imageView?.image = openedImage
如何在Objective-C中进行向下转换?我真的很困惑,因为我在学习C时没有做太多类型转换。
答案 0 :(得分:0)
[[((ViewController *)[windowController contentViewController]) imageView] setImage: openedImage];