Iphone 扩展UIImageView时发送到实例的选择器无法识别
我搜索了所有类似的问题,但找不到答案。我完全被这件事难住了。。。我有一个扩展UIImageView的类。这是我的.h文件:Iphone 扩展UIImageView时发送到实例的选择器无法识别,iphone,ios,ipad,uiimageview,selector,Iphone,Ios,Ipad,Uiimageview,Selector,我搜索了所有类似的问题,但找不到答案。我完全被这件事难住了。。。我有一个扩展UIImageView的类。这是我的.h文件: @interface Paper : UIImageView { @public CGFloat drag; } @property (nonatomic, assign) CGFloat drag; @end 我正在实现中正确地合成拖动 现在,在我的ViewController中,我创建并初始化一个纸对象,如下所示: NSString *tempPath =
@interface Paper : UIImageView {
@public
CGFloat drag;
}
@property (nonatomic, assign) CGFloat drag;
@end
我正在实现中正确地合成拖动
现在,在我的ViewController中,我创建并初始化一个纸对象,如下所示:
NSString *tempPath = [[NSBundle mainBundle] pathForResource:@"picture" ofType:@"png"];
UIImage *tempImage = [[UIImage alloc] initWithContentsOfFile:tempPath];
Paper *tempPaper = [[UIImageView alloc] initWithImage: tempImage];
对象是正确创建的,稍后我可以将其显示为子视图和所有jazz,但当我尝试在上述操作之后立即使用以下行更改自定义属性时:
tempPaper.drag = 1.0;
或
我得到[UIImageView setDrag:]:无法识别的选择器作为错误发送到实例
。我尝试了我找到的每一种不同的方法,但它不允许我为Paper类设置自定义属性(非UIImageView属性)的值。我错过了什么?我花了两个小时在这上面,这让我发疯,我不知道怎么了
我也尝试过在论文的initWithImage
方法中初始化drag
,但也不起作用 创建UIImageView安装的纸张类对象
Paper *tempPaper = [[Paper alloc] initWithImage: tempImage];
纸张*tempPaper=[[Paper alloc]initWithImage:tempImage] 你是我的英雄,这就解决了。。。我真不敢相信我错过了。谢谢是的,这迫使我等了10分钟才接受。
Paper *tempPaper = [[Paper alloc] initWithImage: tempImage];