草庐IT

delegators

全部标签

iOS:我不确定,但我的委托(delegate)没有按我的计划进行

我有一个未按计划运行的代理,我已将其设置为这样。我想调用函数NSLog(show);我不太清楚为什么这不起作用,但可以与我的其他ViewController一起使用。我一定遗漏了一些小细节。AccountViewController.h@protocolAccountViewControllerDelegate;@interfaceAccountViewController:UIViewController{}@property(nonatomic,assign)idaccountViewDelegate;@end@protocolAccountViewControllerDelega

ios - UICollectionView 未显示并未调用委托(delegate)/数据源方法

我有我的数据源方法-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView*)collectionView{return1;}-(NSInteger)collectionView:(UICollectionView*)collectionViewnumberOfItemsInSection:(NSInteger)section{return10;}-(UICollectionViewCell*)collectionView:(UICollectionView*)collectionViewcellForItemAtIn

ios - 从 uitableview cellForRowAtIndexPath 委托(delegate)中删除行时应用程序崩溃

我有一个TableView。我正在实现一个单元格将开始褪色的功能(随着30秒的持续时间减少alpha)。完成30秒后,将调用View动画的完成处理程序以从数据源中永久删除行(一个数组)。所有的东西都在cellForRowAtIndexPath委托(delegate)方法中。我的问题是在更新前和更新后保持数组计数同步。代码:-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{staticNSString*postCellId=@"postCell

ios - 我可以省略 .m 文件中的委托(delegate)声明吗

我是否应该像这样在@interface()block中复制委托(delegate)声明:.h文件@interfaceVKStartScreen:UIViewController@end.m文件@interfaceVKStartScreen()@end或者我可以在.m文件中省略它吗? 最佳答案 您可以在任一文件中省略。你只需要它在一个地方。我个人将委托(delegate)声明放在.m中,除非其他一些类需要知道此类符合这些协议(protocol)。始终选择私有(private),如果出于某种原因需要公开它,请将其打开。

ios - React Native Module 中的 EADemo 从未接收到委托(delegate)方法 handleEvent NSStreamEventOpenCompleted?

我希望我有一个reactnativebridgemodule、线程、委托(delegate)或我不理解的生命周期问题阻止接收委托(delegate)方法调用。我是否需要更改NSStreamscheduleInRunLoop方法?我正在尝试实现reactnativeiOSbridgemodule连接蓝牙“经典”(不是BLE)ExternalAccessory基于Apple'sEADemoexample.EADemo可以独立运行。当我调用EADSessionControlleropenSession从reactnativebridge方法中,handleEvent方法从未被调用?我希望ha

ios - 始终无法从 UIApplication 的 didRegisterForRemoteNotificationsWithDeviceToken 委托(delegate)中获取设备 token

我需要设备token才能在我的应用程序中实现推送通知,就像我从didRegisterForRemoteNotificationsWithDeviceToken方法获取设备token之前一样,但最近它不起作用。有关更多信息,请在didFinishLaunchingWithOptions方法中找到以下代码。if([applicationrespondsToSelector:@selector(registerUserNotificationSettings:)]){UIUserNotificationSettings*settings=[UIUserNotificationSettings

ios - 如何将委托(delegate)更改为 NSURLSession

我正在使用NSURLSession进行服务器通信。我有2个单独的类(class)用于下载和上传文件。我想使用SingleNSURLSession进行下载和上传操作。在这种情况下,我无法在运行时使用setDelegate选项更改NSURLSession的委托(delegate),因为我正在使用委托(delegate)来验证数据。有没有办法在运行时更改NSURLSession的委托(delegate)对象?谢谢。 最佳答案 正如Rob所说,您不能更改NSURLSession的委托(delegate)。您还有一些其他选择。您可以设置一个下

iphone - 使用哪个 NSURLConnection 委托(delegate)

我对从网络服务下载数据有疑问。一种方法是在下面提到的一行中下载它。NSString*returnString=[[NSStringalloc]initWithData:[NSURLConnectionsendSynchronousRequest:urlrequestreturningResponse:nilerror:nil]encoding:NSUTF8StringEncoding];另一种获取方式是通过connectionDidFinishLoading[..]NSURLConnection*theConnection=[[NSURLConnectionalloc]initWith

objective-c - 在 Objective-C 和 iOS 中,似乎委托(delegate)可以去任何方向?

一开始我有点惊讶UIView的绘制是由CALayer帮助完成的,但是CALayer的delegate其实是UIView。好像关系倒过来了。但是,delegate是否真的没有“总指挥”或“所有权”关系......它可以去任何方向:例如,A类可以有一个委托(delegate)B类,同时,B类也可以有一个委托(delegate)A类。更重要的是,可以有多个委托(delegate),这意味着一个对象需要其他多个对象的帮助。有点类似于现实世界,CTO可以将“面试某人的技术能力测试”委托(delegate)给大卫,现在大卫是提供1到10分的委托(delegate)人。但大卫可以委托(delegat

iphone - 在 iphone 中的两个 View Controller 之间使用委托(delegate)

我有两个ViewController:viewcontroller和viewcontroller2nd。我在其中一个中有UILabel并且想在单击viewcontroller2nd中的按钮(名为Go)时更改它。我正在使用委托(delegate)和协议(protocol)来做到这一点。代码如下所示:ViewController.h#import#import"ViewController2nd.h"@interfaceViewController:UIViewController{IBOutletUILabel*lbl;ViewController2nd*secondview;}-(IB