2015-12-30 65 views
1

我有3個視圖(UIViewController)。我想像這樣做012d。但是這個鏈接項目使用的是客觀的C語言,但我需要迅速的語言。請問我可以獲得這個項目的資源。我正在嘗試使用Bridging-Header.h但不工作!swift中的3D立方體過渡視圖

我的代碼波紋管:

import UIKit 

class SecondViewController: CubeController, CubeControllerDataSource, CubeControllerDelegate { 


override func viewDidLoad() { 
    super.viewDidLoad() 



    // Do any additional setup after loading the view. 
} 

override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
    // Dispose of any resources that can be recreated. 
} 


func numberOfViewControllersInCubeController(cubeController: CubeController!) -> Int { 
    return 3 
} 

func cubeController(cubeController: CubeController!, viewControllerAtIndex index: Int) -> UIViewController! { 
    switch(index % 3){ 

    case 0: 
     return AViewController(nibName: "MyViewController", bundle: nil) 
    case 1: 
     return BViewController() 
    case 2: 
     return CViewController() 

    default: 
     return nil 

    } 
} 

/* 
// MARK: - Navigation 

// In a storyboard-based application, you will often want to do a little preparation before navigation 
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 
    // Get the new view controller using segue.destinationViewController. 
    // Pass the selected object to the new view controller. 
} 
*/ 

}

https://maniacdev.com/2013/11/library-allowing-you-to-easily-set-up-view-navigation-with-3d-cube-transitions

回答

1

你必須使用這個類的橋接報:與SWIFT集成

示例代碼:

import UIKit 

@UIApplicationMain 
class AppDelegate: UIResponder, UIApplicationDelegate, CubeControllerDataSource { 

    var window: UIWindow? 


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 

     self.window = UIWindow.init(frame: UIScreen.mainScreen().bounds) 
     let cubeVC : CubeController = CubeController() 
     cubeVC.dataSource = self 
     cubeVC.wrapEnabled = true 
     self.window?.rootViewController = cubeVC 
     self.window?.makeKeyAndVisible() 

     // Override point for customization after application launch. 
     return true 
    } 

    func numberOfViewControllersInCubeController(cubeController: CubeController!) -> Int { 
     return 3 
    } 

    func cubeController(cubeController: CubeController!, viewControllerAtIndex index: Int) -> UIViewController! { 

     let storyboard = UIStoryboard(name: "Main", bundle: nil) 

     switch (index % 3){ 
      case 0: 
       return storyboard.instantiateViewControllerWithIdentifier("VC1") 
      case 1: 
       return storyboard.instantiateViewControllerWithIdentifier("VC2") 
      case 2: 
       return storyboard.instantiateViewControllerWithIdentifier("VC3") 
      default: 
       return nil 
     } 
    } 
} 
+0

偉大的工作@Ashish Kakkad –

+0

謝謝你回覆@Ashis Kakkad兄弟...兄弟我正在嘗試這個代碼它工作正常。你能告訴我PLZ - 我想特定立方體3視圖不想rootviewcontroller。你能幫我嗎? –