草庐IT

custom-selectors

全部标签

ios - 无法在 NSNotificaitonCenter 的 addObserver : selector: name: object: method 中使用 UIApplicationDidEnterBackgroundNotification 作为名称

我将一个文件复制到一个新项目中,它似乎工作正常。这段代码也在旧项目中工作,但突然之间(在新项目中),我遇到了几个我无法弄清楚的错误。NSNotificationCenter*center=[NSNotificationCenterdefaultCenter];[centeraddObserver:selfselector:@selector(saveBookmarks)name:UIApplicationWillTerminateNotificationobject:nil];[centeraddObserver:selfselector:@selector(saveBookmarks

iphone - UIViewController 添加 subview 给我错误 : unrecognized selector

我收到以下错误,我不确定是什么原因造成的。2011-02-0623:38:12.580SApp[9648:207]-[Recordsuperview]:unrecognizedselectorsenttoinstance0x5f2a3502011-02-0623:38:12.583SApp[9648:207]***Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'-[Recordsuperview]:unrecognizedselectorsenttoinstance0x5f2a350'产生

objective-c - "Unrecognized selector sent to instance"错误

我的部分AppDelegate代码是:UITabBarController*tabBarController=(UITabBarController*)self.window.rootViewController;UINavigationController*navigationController=[[tabBarControllerviewControllers]objectAtIndex:0];PilotosViewController*playersViewController=[[navigationControllerviewControllers]objectAtInde

iOS - 在操作中传递参数 :@selector()

我正在以编程方式向UITableViewCell添加一个按钮。按下按钮时要运行的方法是-(void)quantityDown:(id)senderrowNumber:(int)rowNum,其中rowNum是按钮所在的行出现在.将目标添加到按钮时,Xcode会自动完成以下内容:[buttonDownaddTarget:selfaction:@selector(quantityDown:rowNumber:)forControlEvents:UIControlEventTouchUpInside];但是无论我怎样尝试,我都无法将行号传递给方法。我假设代码的相关部分看起来像action:@

ios - Objective C >> 有没有办法检查 Selector 的返回值?

假设我有一个选择器可以分配给几个不同的方法-每个方法都有不同的返回值。有没有办法在调用“performSelector”之前检查选择器持有的方法的返回值是多少? 最佳答案 Isthereawaytocheckwhatisthereturnvalueofthemethodtheselectorisholdingbeforecalling"performSelector"?值(value)?不,类型?是的。您似乎需要方法的返回类型(否则您的问题就没有意义)。Methodm=class_getInstanceMethod([SomeCla

iOS:自定义表格单元格 'unrecognized selector sent to instance'

我有一个带有自定义TableViewCell的tableView。我没有使用.xib文件来布置它。问题是当表应该加载时我收到以下错误:我不确定我在这里做错了什么。这是单元格的.m文件。#import"TCMExhibitListCell.h"@implementationTCMExhibitListCell-(id)initWithStyle:(UITableViewCellStyle)stylereuseIdentifier:(NSString*)reuseIdentifier{self=[superinitWithStyle:stylereuseIdentifier:reuseId

objective-c - "Unrecognized selector"GDB递归时异常说明

在Xcode中使用GDB运行recursiveDescription时,我不断收到无法识别的选择器异常。具体来说,在断点处停止时,我在GDB中输入以下内容:po[[selfview]recursiveDescription]并得到以下异常:-[UILabellength]:unrecognizedselectorsenttoinstance...我不知道是什么标签导致了这种情况,也不知道如何进一步调查,更不用说修复它了。大概recursiveDescription的实现包括[UILabellength]调用,但什么会导致我的标签破坏它?(我的用户界面非常简单,没有对标签或其他任何东西做

ios - -[GAITrackerImpl setAllowIDFACollection :]: unrecognized selector sent to instance

崩溃为了在我们的应用程序中跟踪人口统计数据,我添加了Google推荐的allowIDFACollection=YES行。但是,只要我在没有调试的情况下运行它,就会在下面的第二行出现无法识别的选择器崩溃:gGoogleTracker=[[GAIsharedInstance]trackerWithTrackingId:@"UA-99999999-9"];gGoogleTracker.allowIDFACollection=YES;崩溃:-[GAITrackerImplsetAllowIDFACollection:]:无法识别的选择器发送到实例0x170286d10设置据我所知,GAI已正确

android - "URL with custom scheme"在 iOS 数据和 "URL"在 facebook 的 Android 数据

我有一个应用程序,现在可以在iOS和Android上使用。iOS_app_url类似于https://itunes.apple.com/us/app/.../id...Android_app_url类似于https://play.google.com/store/apps/details?id=...现在我想通过调用https://www.codenameone.com/javadoc/com/codename1/social/FacebookConnect.html#inviteFriends添加“邀请friend”功能允许玩家邀请他的friend安装我的应用程序的功能。我输入htt

iOS 8 :custom Keyboard with undo and redo button

我开发了一个IOS8自定义键盘。我想给它“撤消”和“重做”功能,就像默认的系统键盘一样。我尝试过不同的方法,但无法找到好的解决方案。我们可以使用方法与文本输入对象textDocumentProxy进行交互insertTextdeleteBackwarddocumentContextAfterInputocumentContextBeforeInput但我无法找到任何实现“撤消”和“重做”功能的方法。 最佳答案 我认为我们可以不实现这些功能(撤消、重做)根据https://developer.apple.com/library/ios