我试图在IntelliJ IDEA中创建JavaFX项目,但每次都会出错。
完成教程https://openjfx.io/openjfx-docs/#IDE-Intellij之后,我得到了:
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222)
at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.base/java.lang.Thread.run(Thread.java:834)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) …Run Code Online (Sandbox Code Playgroud) 右边的图片是我需要的,而左边的则是我得到的:
我正在尝试制作一个透明的导航栏,在我读的这本书中,您所要做的就是将这段代码插入首选的View Controller的viewDidLoad()方法中:
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.shadowImage = UIImage()
navigationController?.navigationBar.tintColor = .white
tableView.contentInsetAdjustmentBehavior = .never
Run Code Online (Sandbox Code Playgroud)
但是我得到的只是一个白色的导航栏。另外,如果写出图片上条形的差异在此代码中:
tableView.contentInsetAdjustmentBehavior = .never
Run Code Online (Sandbox Code Playgroud)
但这对我不起作用
我下载了本书这一章的最后一个项目,并且在那儿一切正常,尽管我试图复制粘贴代码,但仍然没有任何改变。
问题是-我已经尝试插入以下代码:
navigationController?.navigationBar.isTranslucent = true
Run Code Online (Sandbox Code Playgroud)
但这不起作用
如果重要的话,这本书是AppCoda撰写的“ iOS 11编程入门”。