2017-04-11 1 views
0

그래서, 나는 app-objective-c와 swift (원래는 objective-c)를 섞어 놓았다. 그리고 나는 2 명의 애플 리케이션 대표자를 갖는 방법을 알아야한다. 다른 하나는 objective-c). 나는 약간의 조사를했지만 아무것도 발견하지 못했습니다. 도와주세요!2 명의 app 대리자, 신속하고 객관적인 -c

는 편집 : 그래서

, 나는 성공적으로 전환,하지만 지금은 내 위임에, 나는이 코드를 가지고 :

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
    // Override point for customization after application launch. 
    let splitViewController = window!.rootViewController as! UISplitViewController 
    let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController 
    navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem 
    splitViewController.delegate = self 
    return true 
} 

을하지만, splitViewController 첫 번째 VC하지, 그래서 어떻게 것 그것을 고정 주위를 이동합니까? (나는 아주 잘 모른다.)

+2

수 없습니다. Apps는 하나의 델리게이트 만 가질 수 있으며 신속하거나 객관적인 C에서 수행 할 것인지 선택해야합니다. –

+0

신속하게 처리하면 다른 코드가 엉망이됩니까? 그리고 그 일을 어떻게 처리할까요? – user7847400

답변

0

오직 하나의 델리게이트가 필요하다. 스위프트에서해야한다. 새 응용 프로그램을 작성하는 경우 엑스 코드는 8.3.1에 따라 다음 인 몇 가지 기본 코드를 사용합니다 :

import UIKit 

@UIApplicationMain 
class AppDelegate: UIResponder, UIApplicationDelegate { 

    var window: UIWindow? 


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
     // Override point for customization after application launch. 
     return true 
    } 

    func applicationWillResignActive(_ application: UIApplication) { 
     // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 
     // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 
    } 

    func applicationDidEnterBackground(_ application: UIApplication) { 
     // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
     // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 
    } 

    func applicationWillEnterForeground(_ application: UIApplication) { 
     // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 
    } 

    func applicationDidBecomeActive(_ application: UIApplication) { 
     // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 
    } 

    func applicationWillTerminate(_ application: UIApplication) { 
     // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 
    } 


} 

는 코멘트에 대답하기 : 그것은 엉망 코드를하지 않습니다. 필요한 경우 이전 Objective C 대리자를 제거합니다.

+0

예전 앱 위임을 삭제하고 새 앱을 만드시겠습니까? – user7847400

+0

둘 다 가질 수는 없으므로 ... 하나를 사용하려면 다른 –

+0

을 제거해야합니다. 그러나 이제는 많은 오류가 발생합니다. – user7847400

관련 문제