草庐IT

Delegate

全部标签

ios - 覆盖不同类型的父类(super class)属性

下面的代码会报错protocolWhatA:AnyObject{funcdoThat()}protocolWhatB:WhatA{funcdoThis()}classSomethingA{weakvardelegate:WhatA?}classSomethingB:SomethingA{weakvardelegate:WhatB?}Property'delegate'withtype'WhatB?'cannotoverrideapropertywithtype'WhatA?'UIKit对以下没有问题openclassUIScrollView:UIView,NSCoding,UIFocu

ios - 覆盖不同类型的父类(super class)属性

下面的代码会报错protocolWhatA:AnyObject{funcdoThat()}protocolWhatB:WhatA{funcdoThis()}classSomethingA{weakvardelegate:WhatA?}classSomethingB:SomethingA{weakvardelegate:WhatB?}Property'delegate'withtype'WhatB?'cannotoverrideapropertywithtype'WhatA?'UIKit对以下没有问题openclassUIScrollView:UIView,NSCoding,UIFocu

ios - 如何在关闭 ViewController 时将数据传递给另一个 Controller ?

我想在VC关闭时将我的数据从一个ViewController传递到另一个VC。可能吗?我已经尝试了下一个方法但没有成功:点击按钮:self.dismiss(animated:true){letstoryboard=UIStoryboard(name:"Main",bundle:nil)letcontroller=storyboard.instantiateViewController(withIdentifier:"EditViewController")as!EditViewControllercontroller.segueArray=[values]}当EditViewContr

ios - 如何在关闭 ViewController 时将数据传递给另一个 Controller ?

我想在VC关闭时将我的数据从一个ViewController传递到另一个VC。可能吗?我已经尝试了下一个方法但没有成功:点击按钮:self.dismiss(animated:true){letstoryboard=UIStoryboard(name:"Main",bundle:nil)letcontroller=storyboard.instantiateViewController(withIdentifier:"EditViewController")as!EditViewControllercontroller.segueArray=[values]}当EditViewContr

ios - Xcode 8 swift 3 : Modal presentation transitioning delegate not called

问题“DrinkTransitioningDelegate”中的委托(delegate)函数未被调用。“td”实例在演示文稿的生命周期期间和之后保留在内存中。classPresentingViewController:UIViewController{lettd=DrinkTransitioningDelegate()functableView(_tableView:UITableView,didSelectRowAtindexPath:IndexPath){letitem=inventory.beverages[indexPath.row]item.isSelected=truele

ios - Xcode 8 swift 3 : Modal presentation transitioning delegate not called

问题“DrinkTransitioningDelegate”中的委托(delegate)函数未被调用。“td”实例在演示文稿的生命周期期间和之后保留在内存中。classPresentingViewController:UIViewController{lettd=DrinkTransitioningDelegate()functableView(_tableView:UITableView,didSelectRowAtindexPath:IndexPath){letitem=inventory.beverages[indexPath.row]item.isSelected=truele

ios - 应用程序委托(delegate)中用于 Facebook 和 Twitter 的 OpenURL?

我正在使用FacebookSDK和TwitterSDK进行登录和注册。但它们都不是通过一种常用方法打开URL。我为Facebook编写了如下代码:funcapplication(application:UIApplication,openURLurl:NSURL,sourceApplication:String?,annotation:AnyObject)->Bool{if(url.scheme=="fb1651015905222312"){returnFBSDKApplicationDelegate.sharedInstance().application(application,o

ios - 应用程序委托(delegate)中用于 Facebook 和 Twitter 的 OpenURL?

我正在使用FacebookSDK和TwitterSDK进行登录和注册。但它们都不是通过一种常用方法打开URL。我为Facebook编写了如下代码:funcapplication(application:UIApplication,openURLurl:NSURL,sourceApplication:String?,annotation:AnyObject)->Bool{if(url.scheme=="fb1651015905222312"){returnFBSDKApplicationDelegate.sharedInstance().application(application,o

xcode - 在应用程序委托(delegate)中获取主窗口 Controller 的实例

我知道,对于iOS,您可以像这样从应用委托(delegate)中引用RootViewController:varrootViewController=self.window!.rootViewController当目标为OSX时,如何从应用委托(delegate)中引用主窗口Controller?我想以这种方式传递一个变量(托管对象上下文),因为我读到它是引用moc的一个很好的解决方案。 最佳答案 您可以像这样访问主NSWindow的NSWindowController实例:NSApplication.sharedApplicati

xcode - 在应用程序委托(delegate)中获取主窗口 Controller 的实例

我知道,对于iOS,您可以像这样从应用委托(delegate)中引用RootViewController:varrootViewController=self.window!.rootViewController当目标为OSX时,如何从应用委托(delegate)中引用主窗口Controller?我想以这种方式传递一个变量(托管对象上下文),因为我读到它是引用moc的一个很好的解决方案。 最佳答案 您可以像这样访问主NSWindow的NSWindowController实例:NSApplication.sharedApplicati