我想通过使用swift来获得3D立方体3或4视图(UIViewController)。我关注这个网站Link。 我的代码是吼叫。当我只选择3个视图时,我想要3d立方体视图。但我的项目正在全力以赴观看3D。怎么能停止所有页面的3d立方体。
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
}
}