我有3个视图(UIViewController)。我想像这样Link做3d立方体。但是这个链接项目已经被客观C使用了,但我需要快速的语言。请问我可以获得这个项目的资源。我正在尝试使用Bridging-Header.h但不能正常工作!!
My Code Bellow:
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
this.menu=menu;
updateMenuItems(menu);
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.document_list_activity_actions, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle presses on the action bar items
if (item.getItemId() == android.R.id.home) {
onHomeButtonPresssed();
}else if (item.getItemId() == R.id.action_delete) {
useCheckBoxAdapter=false;
deleteDocuments();
} else if (item.getItemId() == R.id.share) {
useCheckBoxAdapter=false;
shareDocuments();
} else if (item.getItemId() == R.id.action_tick) {
useCheckBoxAdapter=true;
onShowCheckboxes();
}
updateMenuItems(menu);
return true;
}
private void updateMenuItems(Menu menu){
if (useCheckBoxAdapter && menu != null) {
menu.findItem(R.id.action_delete).setVisible(true);
menu.findItem(R.id.share).setVisible(true);
menu.findItem(R.id.action_tick).setVisible(false);
} else {
menu.findItem(R.id.action_delete).setVisible(false);
menu.findItem(R.id.share).setVisible(false);
menu.findItem(R.id.action_tick).setVisible(true);
}
invalidateOptionsMenu();
}
}
答案 0 :(得分:1)
您必须为此类使用桥接标头:
快速集成的示例代码:
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
}
}
}