草庐IT

SELECTOR

全部标签

iphone - cocos2d中如何给Button添加Action

我使用这段代码为我的cocos2d项目创建了我的ButtonCCMenuItem*starMenuItem=[CCMenuItemImageitemFromNormalImage:@"ButtonStar.jpg"selectedImage:@"ButtonStarSel.jpg"target:selfselector:@selector(starButtonTapped:)];starMenuItem.position=ccp(60,60);CCMenu*starMenu=[CCMenumenuWithItems:starMenuItem,nil];starMenu.position

iphone - 为条形按钮调用具有多个参数和来自不同类的选择器

我有一个Objective-CClass(名为Constants),一些Method有一个Argument说。..+(void)someMethod:(id)arg{//SomeStuff...}我想将此方法附加到某些UIBarButtonItem(添加到某些其他UIViewController的某些NavigationBar中)。我在导航栏中有rightBarButton。UIBarButtonItem*rightBarButton=[[UIBarButtonItemalloc]initWithTitle:@"someTitle"style:UIBarButtonItemStyleB

iphone - 从 @selector 中关闭 View Controller 而不创建单独的方法

我试图通过直接从按钮执行它来关闭呈现的ViewController,而不是只为它创建一个单独的方法,但我不知道如何让它工作,或者它是否可能。感谢您提供的任何帮助!我正在尝试的代码:[dismissButtonaddTarget:selfaction:@selector(dismissViewControllerAnimated:YEScompletion:NULL)forControlEvents:UIControlEventTouchUpInside];我不想做的事:-(void)dismissThis{[selfdismissViewControllerAnimated:YESco

ios - 无法将应用提交到应用商店,错误为 : "non-public selector"

我有问题:无法将应用程序提交到AppStore。我在Xcode5中构建应用程序的存档,验证AppStore的存档并出现错误:“应用程序引用非公共(public)选择器在Payload/MyProj.app/MyProj:startIndex中”。在应用程序中使用了GoogleplusSDK(最新版本)。当我从应用程序中删除此SDK时,验证成功。我发现类似的问题:https://code.google.com/p/google-plus-platform/issues/detail?id=677.有什么帮助吗? 最佳答案 我在使用Go

ios - 表格单元格内的按钮 - 将数据传递给选择器

这个主题遍布整个stackoverflow,但我找不到合适的解决方案。我在每个UITableViewCell上都有按钮。下面是我如何创建单元格。-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{UITableViewCell*cell=[tableViewdequeueReusableCellWithIdentifier:@"ExaminationCell"];UIButton*clipButton=(UIButton*)[cellviewW

ios - DFP 插页式 : unrecognized selector gad_MD5String

我正在为我的IOS应用程序添加GoogleDFPInterstitial支持GADRequest*request=[GADRequestrequest];该行抛出异常:[__NSCFStringgad_MD5String]:unrecognizedselectorsenttoinstance0x14f5ac30我不知道该怎么办。GoogleAdMobSDK已更新,Analytics正常。 最佳答案 如果其他人来到这里并且现有答案(即使用旧版本的admob)或评论(使用最新版本)都不能解决问题,则解决方案可能只是将链接器标志-ObjC

iOS:在方法中包装异步调用

我一直想知道下面的场景是否可能:给定函数foo定义为-(void)foo:(int)naction:(SEL)selector{//dosomething,maybefetchingdatafromserver...//atalaterpoint[selfperformSelector:@selector(selector)withObject:returnObject];}注意:foo是提供给您的黑盒函数。无论如何都不能改变通常会创建函数bar-(id)bar:(id)x{returnx;}并调用[selffoo:naction:@selector(bar:)]在函数bar中得到结果

ios - 如何解决错误 'No visible @interface for ' UIViewController' declares the selector ''

我正在使用Xcode5这是我的AppDelegate.h文件#import@interfaceAppDelegate:UIResponder@property(strong,nonatomic)UIWindow*window;@property(strong,nonatomic)UIViewController*viewController;@end这是我的AppDelegate.m文件#import"AppDelegate.h"#import"ViewController.h"@implementationAppDelegate@synthesizewindow=_window;@s

ios - UIDeviceBatteryLevelDidChangeNotification 后台通知?

我们正在寻求开发一款应用程序,如果用户的电池电量低于某个百分比,它会提醒用户,但是我们发现我们的应用程序在未处于事件状态时不会收到此NSNotifications。有没有人有使用UIDeviceBatteryNotifications的经验,并且知道这是否完全可行,从我从Apple文档中看到的情况来看,它似乎应该可以工作。我们基本上是这样做的-(void)startMonitoring{[[UIDevicecurrentDevice]setBatteryMonitoringEnabled:YES];[[UIDevicecurrentDevice]batteryLevel];[[NSNo

ios - 无法识别的选择器 isPitched called

在我的应用程序中,我正在显示带有注释的map,用户可以在TableView(在模态视图Controller中)中浏览注释列表。我遇到了一个奇怪的错误,我可以在设备和模拟器(iOS7和8)中重现该错误。在倾斜模式下,如果我尝试在我的POITableView中选择一个项目,它会执行以下操作之一:将map中心更改为map上的随机点,而不是所选注释。因我放入的消息(启用NSZombies)而崩溃。-[__NSCFStringisPitched]:unrecognizedselectorsenttoinstance0x7f24e6e0我尝试了几种方法来解决这个错误,但都没有成功。令我困惑的是我找