草庐IT

APPDELEGATE

全部标签

ios - 在 AppDelegate 中检测抖动

如何在Swift中的AppDelegate(跨整个应用程序)中检测设备抖动?我找到了描述如何在ViewController中执行此操作的答案,但希望在我的应用程序中执行此操作。 最佳答案 如果要全局检测抖动,UIWindow实现可以接收抖动事件的UIResponder。您可以将以下代码片段添加到AppDelegateextensionUIWindow{openoverridefuncmotionEnded(_motion:UIEventSubtype,withevent:UIEvent?){ifmotion==.motionShak

ios - 在 AppDelegate 中检测抖动

如何在Swift中的AppDelegate(跨整个应用程序)中检测设备抖动?我找到了描述如何在ViewController中执行此操作的答案,但希望在我的应用程序中执行此操作。 最佳答案 如果要全局检测抖动,UIWindow实现可以接收抖动事件的UIResponder。您可以将以下代码片段添加到AppDelegateextensionUIWindow{openoverridefuncmotionEnded(_motion:UIEventSubtype,withevent:UIEvent?){ifmotion==.motionShak

xcode - 'AppDelegate' 没有名为 'managedObjectContext' 的成员

我一直在关注如何快速使用CoreData获取值的指南。我一直遇到错误“AppDelegate”没有名为“managedObjectContext”的成员。该指南使用的是XCode的Beta版,这是否已更改以及关于如何解决我的问题的任何想法。@IBActionfuncsaveButtonPushed(sender:AnyObject){varappDel:AppDelegate=(UIApplication.sharedApplication().delegateasAppDelegate)varcontext:NSManagedObjectContext=appDel.managedO

xcode - 'AppDelegate' 没有名为 'managedObjectContext' 的成员

我一直在关注如何快速使用CoreData获取值的指南。我一直遇到错误“AppDelegate”没有名为“managedObjectContext”的成员。该指南使用的是XCode的Beta版,这是否已更改以及关于如何解决我的问题的任何想法。@IBActionfuncsaveButtonPushed(sender:AnyObject){varappDel:AppDelegate=(UIApplication.sharedApplication().delegateasAppDelegate)varcontext:NSManagedObjectContext=appDel.managedO

ios - 为什么窗口在 AppDelegate 中为零

我需要从AppDelegate显示ViewController,所以我写了下面的代码:letstoryboard=UIStoryboard(name:"Main",bundle:nil)letauthViewController=storyboard.instantiateViewControllerWithIdentifier("ViewController")asViewControllerifletkeyWindow=UIApplication.sharedApplication().keyWindow{keyWindow.rootViewController=authViewC

ios - 为什么窗口在 AppDelegate 中为零

我需要从AppDelegate显示ViewController,所以我写了下面的代码:letstoryboard=UIStoryboard(name:"Main",bundle:nil)letauthViewController=storyboard.instantiateViewControllerWithIdentifier("ViewController")asViewControllerifletkeyWindow=UIApplication.sharedApplication().keyWindow{keyWindow.rootViewController=authViewC

Swift:如何访问 AppDelegate 中的 navigationController

我在StoryBoard中添加了一个NavigationController并将其设为初始viewController。如何访问appDelegate中的NavigationController。按住Ctrl从navigationController拖动到AppDelegate不会创建导出。 最佳答案 在didFinishLaunchingWithOptions中:letnavigationController=application.windows[0].rootViewControlleras!UINavigationContr

Swift:如何访问 AppDelegate 中的 navigationController

我在StoryBoard中添加了一个NavigationController并将其设为初始viewController。如何访问appDelegate中的NavigationController。按住Ctrl从navigationController拖动到AppDelegate不会创建导出。 最佳答案 在didFinishLaunchingWithOptions中:letnavigationController=application.windows[0].rootViewControlleras!UINavigationContr

ios - 为什么 AppDelegate.swift 窗口是可选的?

我正在阅读Appledocs,当我发现这句话时:TheAppDelegateclasscontainsasingleproperty:window.varwindow:UIWindow?Thispropertystoresareferencetotheapp’swindow.Thiswindowrepresentstherootofyourapp’sviewhierarchy.Itiswhereallofyourappcontentisdrawn.Notethatthewindowpropertyisanoptional,whichmeansitmayhavenovalue(benil

ios - 为什么 AppDelegate.swift 窗口是可选的?

我正在阅读Appledocs,当我发现这句话时:TheAppDelegateclasscontainsasingleproperty:window.varwindow:UIWindow?Thispropertystoresareferencetotheapp’swindow.Thiswindowrepresentstherootofyourapp’sviewhierarchy.Itiswhereallofyourappcontentisdrawn.Notethatthewindowpropertyisanoptional,whichmeansitmayhavenovalue(benil