我有一个使用Main.sotyboard用Xcode 10制作的应用程序,想将其迁移到使用Apple的新框架:SwiftUI。
那已经有可能吗?
我已经尝试在中添加UIApplicationSceneManifest键Info.plist,更改了AppDelegate.swift使用场景,创建了SceneDelegate.swift,即使这样我也无法
我在AppDelegate.swift中有以下代码来为iOS应用程序设置根视图控制器。但这行不通。它遵循目标结构(在“常规”选项卡下定义),并忽略此代码。
(Xcode 11,Swift 5.1,iOS 13)
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
guard let rootVC = UIViewController() else {
print("Root VC not found")
return true
}
let rootNC = UINavigationController(rootViewController: rootVC)
window?.rootViewController = rootNC
window?.makeKeyAndVisible()
return true
}
}
Run Code Online (Sandbox Code Playgroud)
无法了解问题出在哪里。
我也尝试了以下参考,但没有运气:
我不想在我的 Xamarin.iOS 应用程序中使用故事板,因此我执行了以下操作:
1-删除了故事板文件。
2- 更新了 plist.info 文件应用程序 > 主界面,使其没有价值。
3- 将以下代码添加到AppDelegate文件中。
[Export ("application:didFinishLaunchingWithOptions:")]
public bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
// create a new window instance based on the screen size
Window = new UIWindow(UIScreen.MainScreen.Bounds);
var controller = new UIViewController();
controller.View.BackgroundColor = UIColor.LightGray;
controller.Title = "My Controller";
var navController = new UINavigationController(controller);
Window.RootViewController = navController;
// make the window visible
Window.MakeKeyAndVisible();
return true;
}
Run Code Online (Sandbox Code Playgroud)
但是在这样做之后,我在启动屏幕完成后在模拟器上收到了一个黑屏。即使是全新的项目也会发生这种情况。我已上载这些步骤和问题的样本新的项目在这里。
我正在使用 Visual Studio 2019 - Xamarion.iOS 11.8.3 - XCode …