我试图简单地呈现一个ViewController,但是,这并没有使用PerformSegue
方法或PresentViewController
方法,似乎没有任何事情发生。我已经验证使用调试器达到了正确的代码行,我还验证了名称和ID是否正确。
namespace Proj
open System
open Foundation
open UIKit
[<Register ("FirstPage")>]
type FirstPage (handle:IntPtr) =
inherit UIViewController (handle)
override x.DidReceiveMemoryWarning () =
base.DidReceiveMemoryWarning (
)
override x.ViewDidLoad () =
base.ViewDidLoad ()
let value = NSUserDefaults.StandardUserDefaults.StringForKey("type")
x.View.BackgroundColor <- UIColor.Blue
if value <> null then
if value = "landlord" then
let Storyboard = UIStoryboard.FromName("Main", null)
let viewController = Storyboard.InstantiateViewController("landlord_home") :?> UINavigationController
x.PresentViewController(viewController,true,null)
else
if value = "tenant" then
let Storyboard = UIStoryboard.FromName("Main", null)
let viewController = Storyboard.InstantiateViewController("tinder_interface") :?> BackgroundAnimationViewController
x.PresentViewController(viewController,true,null)
else
x.PerformSegue("goToNameReg",x)
override x.ShouldAutorotateToInterfaceOrientation (toInterfaceOrientation) =
if UIDevice.CurrentDevice.UserInterfaceIdiom = UIUserInterfaceIdiom.Phone then
toInterfaceOrientation <> UIInterfaceOrientation.PortraitUpsideDown
else
true