Mac应用程序:视图控制器转换后按钮框架和图像不可见

时间:2016-10-07 15:41:10

标签: swift xcode macos segue

转换后,正在运行的应用程序中缺少按钮设计和图像内容。它看起来像这样:

View in Xcode and in the app

我的自定义segue的代码是这样的:

override func perform() {

    // build from-to and parent-child view controller relationships
    let sourceViewController  = self.sourceController as! NSViewController
    let destinationViewController = self.destinationController as! NSViewController
    let containerViewController = sourceViewController.parent! as NSViewController

    // add destinationViewController as child
    containerViewController.insertChildViewController(destinationViewController, at: 1)

    //perform transition
    containerViewController.transition(from: sourceViewController, to: destinationViewController, options: NSViewControllerTransitionOptions.slideLeft, completionHandler: nil)

    // lose the sourceViewController, it's no longer visible
    containerViewController.removeChildViewController(at: 0)
}

1 个答案:

答案 0 :(得分:0)

这只是猜测。但看起来你的窗口是一个视觉效果视图/窗口组合。哪个好。但我认为默认行为是所有子视图采用" vibrancy"出现。这可能会对图像产生奇怪的行为,因为它会尝试使用图像的Alpha通道来产生某些效果。您是否尝试过设置" allowsVibrancy"图像视图的属性或其父视图为NO?