草庐IT

make_member_delegate

全部标签

ios - swift 警告 : Application delegate received call to -application:performFetchWithCompletionHandler: but the completion handler was never called

我在下面的模拟器中调用这个函数来模拟后台获取。然后我在日志中收到这个警告:SwiftWarning:Applicationdelegatereceivedcallto-application:performFetchWithCompletionHandler:butthecompletionhandlerwasnevercalled.我看到其他StackIverflow回答说我只需要添加completionhandler()。我试过了,它说我需要添加一个参数,这就是我迷路的地方。funcapplication(_application:UIApplication,performFetc

swift - 不使用硬件键盘返回调用 UITextField 委托(delegate) textFieldShouldReturn

iOS12、Xcode10.1。我有一个包含UITextField的View。委托(delegate)连接连接到Storyboard中的ViewController。我以前已经做过无数次了。我想在键盘上按下Return时将第一响应者发送到下一个字段,所以正确的做法是这样的:extensionSignInViewController:UITextFieldDelegate{functextFieldShouldReturn(_textField:UITextField)->Bool{switchtextField{caseloginEmailField:loginPasswordFiel

ios - 协议(protocol)要求委托(delegate)继承自 UIViewController

我有一个看起来像这样的协议(protocol)ShareDelegate:protocolShareDelegate:class{funcshare(event:EventJSONModel,skipToTimetime:CMTime?,view:UIView,completion:@escaping()->())}extensionShareDelegatewhereSelf:UIViewController{funcshare(event:EventJSONModel,skipToTimetime:CMTime?=nil,view:UIView,completion:@escapi

ios - delegate 在 urlSession 的操作中变为 nil。如何将委托(delegate)变量保存在单独的线程中?

我正在使用OperationQueue使用URLSession.dataTask将文件一个一个地上传到远程服务器。委托(delegate)用于更新进度条,但在实现OperationQueue后,我的委托(delegate)变为零。它在没有OperationQueues的情况下工作。在程序运行时查看堆栈,我看不到进度条的ViewController。已经好几天了,我还是不太明白。我猜ViewController正在被释放,但我不确定如何防止它被释放。谢谢。我在NetWorkViewController中将委托(delegate)设置为self,但在我的NetworkManager类的ur

ios - 自定义委托(delegate)和数据源 NSObject 最佳实践

考虑这种情况,我有一个UIViewController,它包含一个简单的UICollectionView,但是Delegate&DataSource协议(protocol)是分开的来自UIViewController的NSObject。看起来像这样classMainCollctionViewDelegate:NSObject,UICollectionViewDelegateclassMainCollectionViewDataSrouce:NSObject,UICollectionViewDataSource我在我的UIViewController中像这样使用它们,lazyvarCVD

swift - Codable - arrayPropety [AnyObject] : Reference to member 'data' cannot be resolved without a contextual type

设置Codable类。AnyObjects数组产生编译错误:Referencetomember'data'cannotberesolvedwithoutacontextualtypeclassClassA:NSObject,Codable{//MARK:-Propertieslettitle:Stringletdata:[T]//dataisanarrayofeitherCodableobjectsofClassBorClassC.//MARK:-KeyesprivateenumCodingKeys:String,CodingKey{casetitlecasedata}required

swift - swift 改变(精炼)委托(delegate)类型

我有一个(swift)类,它有一个指向委托(delegate)的弱指针,如下所示:importUIKit@objcpublicprotocolDRSlidingPanelViewControllerDelegate:class{optionalfuncdidSlidePanel(panelHidden:Bool,sender:DRSlidingPanelViewController)->Void}publicclassDRSlidingPanelViewController:UIViewController{publicweakvardelegate:DRSlidingPanelVie

ios - 为什么在 App Delegate 中调用 viewdidload 时所有 IBOutlet(s) 都为 nil?

我的Xcode调试器报告,除了alltheIBOutlets发现nil(myLine等)外,所有其他值包括alive(bool值)都已设置。顺便说一句,当我删除AppDelegate中的所有代码时一切正常,但我需要此View经常更新,因此有必要在applicationWillEnterForeground中实现它。另一件值得指出的事情是,在配置View1和2中,我设置了每个socket的值。并且我在此之前让应用程序委托(delegate)调用viewdidload方法,因此所有socket都应该已经与代码连接,所以这些socket不应该为零。Anerrormessageinthedeb

swift - 我应该如何命名返回 "continue"标志的委托(delegate)方法?

在我的Swift代码中,我有几个看起来像这样的方法:protocolEditorDelegate{//...funcdidStartSearch(query:String)->Bool}classEditor:UIViewController{funcsearch(sender:AnyObject){letwasHandled=self.delegate?.didStartSearch(query)??falseif!wasHandled{//dodefaultsearchingbehavior}}}这有效,但它不是self记录的。didStartSearch方法并没有真正表明它正在返

ios - swift 3.0 : Value of type 'IndexSet' has no member 'enumerateIndexesUsingBlock'

接收“IndexSet”类型的值在enumerateIndexesUsingBlock处没有成员“enumerateIndexesUsingBlock”错误。/**Extensionforcreatingindexpathsfromanindexset*/extensionIndexSet{/**-parametersection:ThesectionforthecreatedNSIndexPaths-return:AnarraywithNSIndexPaths*/funcbs_indexPathsForSection(_section:Int)->[IndexPath]{varind