无法打开viewcontroller - ios F#(performSegue和presentviewcontroller)

时间:2017-12-27 19:32:28

标签: ios xamarin f# segue

我试图简单地呈现一个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

0 个答案:

没有答案