草庐IT

ios - 委托(delegate)方法未被称为 Objective-C

我正在尝试将secondViewController中的两个文本字段的数据传递给ViewController并在ViewController中设置标签文本。但是没有调用传递数据的委托(delegate)方法。我已经通过放置断点来检查它。因此标签文本没有改变。SecondViewController.h#import@classSecondViewController;@protocolSecondViewDelegate-(void)getText1:(NSString*)str1andText2:(NSString*)str2;@end@interfaceSecondViewCont

iphone - 为什么保留 NSURLConnection 和 CAAnimation 委托(delegate)?

我是iOS开发的新手。我才知道他们是Foundation中保留的两个代表。我的理解是代表必须始终松散耦合。那为什么特意保留这两个呢?谢谢 最佳答案 通常,一个对象的整个生命周期都需要一个委托(delegate),这就是为什么它通常是一个弱/非保留引用。否则,对象和委托(delegate)都不能被释放,因为它们都将等待对方离开。然而,在NSURLConnection和CAAnimation的情况下,实际上只有具有某种“完成”状态的特定任务才需要委托(delegate)。当连接完成加载/取消或动画结束时,他们可以自己释放委托(deleg

iphone - 如何使 Xcode 自动完成委托(delegate)方法?

此代码使用委托(delegate)[[[UIAlertViewalloc]initWithTitle:@"Error"message:@"Youcanleavethetextblank"delegate:selfcancelButtonTitle:@"Quit"otherButtonTitles:@"OK",nil]show];有问题的代表是:(void)alertView:(UIAlertView*)alertViewclickedButtonAtIndex:(NSInteger)buttonIndex{我的问题是:您如何为Xcode委托(delegate)方法自动完成?在Eclip

objective-c - NSURLConnection 委托(delegate)方法未被调用

我正在尝试使用NSURLConnection的委托(delegate)方法。当前未调用以下方法:-(void)connectionDidFinishLoading:(NSURLConnection*)connection;-(void)connection:(NSURLConnection*)connectiondidReceiveData:(NSData*)data;-(void)connection:(NSURLConnection*)connectiondidReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge*

ios - 未为 API 监听器调用 NSFetchedResultsController 委托(delegate)

如果代码将委托(delegate)分配给NSFetchedResultsController,如下所示:-(id)initWithFetchedResultsController:(NSFetchedResultsController*)fetchedResultsController{self=[superinit];if(self!=nil){fetchedResultsController.delegate=self;_fetchedResultController=fetchedResultsController;}returnself;}NSFetchedResultsCon

ios - iOS 13 中未调用应用程序委托(delegate)方法

我正在使用Xcode11并为iOS13构建应用程序。在我在Xcode中创建的新项目中,缺少一些UIApplicationDelegate方法,因此我将它们添加回应用程序委托(delegate)文件中。“单一View应用程序”项目的新模板缺少方法。问题是除了-application:didFinishLaunchingWithOptions:之外,没有任何委托(delegate)方法被调用。这是我的应用委托(delegate):@implementationAppDelegate-(BOOL)application:(UIApplication*)applicationdidFinish

iphone - 应用委托(delegate)对象

在我的appdelegate中,我声明了一个我开发的自定义类的对象。在我的ViewController中,我添加了以下代码行:AppDelegate*appDelegate=(AppDelegate*)[[UIApplicationsharedApplication]delegate];[appDelegate.dbConnectorloadImages:self];没有错误,但是即使编译器处理了loadImages,也不会进入函数。我已经使用断点来检查这一点。有什么建议吗? 最佳答案 您的dbConnector属性可能为nil。确

iphone - UITextView 委托(delegate)方法 textView :shouldChangeTextInRange:replacementText: gives erroneous replacementText on fast delete

我有一个UITextView,我正在将所有TextView更改事件记录到一个数组中。当用户快速删除时(按住delete键一次删除一个单词而不是一个字符),当调用textView:shouldChangeTextInRange:replacementText方法时,范围变量的长度只有1,当在实际上,范围应该是单词中删除的字母数。有谁知道这个AppleBug的任何解决方法,以便我可以正确识别位置和范围以及UITextView中更改的文本? 最佳答案 不,这不是错误。每次更改文本时都会调用此函数。可能您正在使用Debug模式并使用键盘退格

ios - 如何为 cpp 类创建 objective-c 委托(delegate)?

我一直在尝试将openGL-es(xcodeopenGL游戏模板与powervr3.0sdk的ogles2tools库结合起来。我的问题是我加载效果文件的代码行:/*Loadtheeffect.Wepass'this'asanargumentaswewishtoreceivecallbacksasthePFXisloaded.ThisisoptionalandsupplyingNULLimpliesthatthedeveloperwilltakecareofalltextureloadingandbindingtototheEffectinstead.*/if(m_pEffect->L

ios - 在 Objective-c 问题中访问委托(delegate)静态方法

我在objective-c中遇到了一个奇怪的问题。这是代码:STViewController.h#import@interfaceSTViewController:UIViewController+(void)myStaticMethod;@endSTViewController.m#import"STViewController.h"@implementationSTViewController-(void)viewDidLoad{[superviewDidLoad];[STViewControllermyStaticMethod];}+(void)myStaticMethod{UI