草庐IT

property_selector

全部标签

iphone - 设置单例类的@property

目前我在AppDelegate类上使用一个属性。现在,随着我的需求的增加,我需要超过1个这样的全局属性,所以我想创建一个Singleton类来保存这些属性并管理它们。我找到了很多关于单例的信息,但我想不通,是否可以在没有类实例的情况下修改属性?例如:@interfaceTools:NSObject@property(nonatomic,retain)NSDictionary*item;...@end我想做的事:[ToolssetItem:someDict];someClass=[someClassalloc]initWithItem:[ToolsgetItem]];我所有的想法都以类T

ios - -[UIImage _imageByUnpremultiplying] : unrecognized selector sent to instance

我在使用CI过滤器时遇到了奇怪的错误,我怎么能通过查看日志来知道我错过了什么CIFilter*filter=[CIFilterfilterWithName:@"CIFalseColor"];[filtersetValue:imageforKey:@"inputImage"];CIColor*myBlue=[CIColorcolorWithRed:0.0green:0.0blue:0.6alpha:0.5];[filtersetValue:myBlueforKey:@"inputColor0"];CIImage*filteredImageData=[filtervalueForKey:@

ios - Xcode 错误 : Auto property synthesis is synthesizing property not explicitly synthesized

在.h文件中添加了两个属性:@property(assign,nonatomic,readonly)floatweightInLbs;@property(strong,nonatomic,readonly)NSDate*date;他们生成此Xcode错误:自动属性合成正在合成未显式合成的属性我正在运行Xcode5.1,目标是iOS7.1。这是什么意思,我需要做什么? 最佳答案 尝试更改项目build设置中的“隐式合成属性”标志 关于ios-Xcode错误:Autopropertysynt

ios - addressDictionary 已弃用 : first deprecated in iOS 11. 0 - 使用@properties

我正在使用获取位置和地址。因为我已成功获取位置,但在获取地址时我收到类似警告,'addressDictionary'isdeprecated:firstdeprecatediniOS11.0-Use@properties有什么解决办法吗... 最佳答案 在swift5中//letlocation:CLLocation=CLLocation(latitude:16.511131,longitude:80.658725)//Convertlat&lngintoCLLocationletgeocoder=CLGeocoder()geoco

ios - appname.ViewsVC collectionView :cellForItemAtIndexPath:]: unrecognized selector sent to instance

我正在构建一个CollectionView并收到以下错误。Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'-[appname.ViewsVCcollectionView:cellForItemAtIndexPath:]:unrecognizedselectorsenttoinstance这是我自定义单元格的代码//cellconfigurationfunccollectionView(_collectionView:UICollectionView,cellForItemAtindexPa

ios - 为什么 Xcode 在使用 @selector 时不提示未声明的方法?

为什么使用常规方式调用类接口(interface)中未声明的方法时会产生警告,而使用@selector调用方法时却不会?是因为选择器可以由与自身不同的调用者执行吗?例如:-(void)doStuff{[selfdoNow];//Warning:instancemethodnotfoundSELsel=@selector(doNow);//nowarnings}-(void)doNow{}//thismethodisnotdeclaredintheinterface 最佳答案 “未声明的选择器”警告默认关闭。我不知道为什么。您可以在b

❤ cannot read properties of null(reading appendChild)解决办法

❤操作元素报:cannotreadpropertiesofnull(readingappendChild)解决办法1、场景:写的一个js渲染,但是出了个小问题,cannotreadpropertiesofnull(readingappendChild)报错。大致意思是:不能读取空的属性。2、解决方案1、console.log()//打印数据内容,查看获取数据是否有问题。2、js引入放body最后面,页面是自上而下的运行的,HTML都没有运行到,当然获取不到对应节点3、使用getElementsByClassName(''div")获取元素时,其返回的是数组,而没有定位到某一具体对象还有getE

iphone - ARC 语义问题 : No visible @interface for Class declares the selector

非常基本的东西,但我无法解决问题所在。在我的项目中,我有一个名为“TheFeedStore”的类,它具有以下两种方法:-(BOOL)hasItemBeenRead:(RSSItem*)item{............}-(void)markItemAsRead:(RSSItem*)item{.........}我正在使用以下类方法,以便其他类可以使用它访问这些方法:+(TheFeedStore*)sharedStore{staticTheFeedStore*feedStore=nil;if(!feedStore){feedStore=[[TheFeedStorealloc]init]

ios - "Unrecognized selector sent to instance"使用自定义表格单元格时

我已经实现了自定义表格单元格,当表格进入cellForRowAtIndexPath时收到运行时错误(“无法识别的选择器发送到实例”)。尝试实例化自定义单元格时发生错误。我之前已经成功地做到了这一点,但现在错误不会消失。我有一个prtotype单元格,它的自定义类属性设置为自定义单元格UITableViewCell子类。这是自定义单元格:#import"FavoriteCell.h"@implementationFavoriteCell@synthesizelblGaugeID,lblMainTitle,bgImage;-(id)initWithStyle:(UITableViewCel

TypeError: Cannot read property 'setData' of undefined如何解决这个报错

这个错误表明你在访问一个未定义的对象的"setData"属性。这可能是由于你没有正确引用这个对象或者这个对象没有"setData"属性造成的。解决方法:检查是否正确引用了这个对象检查这个对象是否有"setData"属性检查这个对象是否在正确的作用域内检查你是否正确初始化了这个对象如果无法解决问题,请提供更多上下文代码和细节,我将尽力帮助您。