0
我是iOS开发人员中的新成员。如何将AppDelegate与Swift 3和Objective-c混合
我有下一个问题,应用程序的主要语言是Objective-c我想委托写在Swift 3上的函数,我该怎么做?
我希望你能帮助我。
我是iOS开发人员中的新成员。如何将AppDelegate与Swift 3和Objective-c混合
我有下一个问题,应用程序的主要语言是Objective-c我想委托写在Swift 3上的函数,我该怎么做?
我希望你能帮助我。
在迅速也许创造新的项目取得模板AppDelegate中,然后在以后的使用SWIFT代码任何操作:
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> 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 throttle down OpenGL ES frame rates. 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 inactive 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的混合? –
你不能混用它,你可以在这种情况下用Swift替换Obj-C。 – Stefan
这不回答OP的问题 – p10ben