Ios 属性在UIView类中不起作用
初学者问题: 我创建了一个新类,它是UIImageView的一个子类。 为什么当我试图创建一个方法时,我不能使用任何UIView属性Ios 属性在UIView类中不起作用,ios,Ios,初学者问题: 我创建了一个新类,它是UIImageView的一个子类。 为什么当我试图创建一个方法时,我不能使用任何UIView属性 -(id)initWithImage:(UIImage *)image { self = [super initWithImage:image]; if (self) { UIRotationGestureRecognizer *rotationGestureRecognizer= [[UIRotationGestureRecogn
-(id)initWithImage:(UIImage *)image
{
self = [super initWithImage:image];
if (self) {
UIRotationGestureRecognizer *rotationGestureRecognizer= [[UIRotationGestureRecognizer alloc]initWithTarget:self action:<#(SEL)#>];
[self addGestureRecognizer:rotationGestureRecognizer];
}
return self;
}
-(void) handleRotations: (UIRotationGestureRecognizer *) paramSender
{
self.transform
}
-(id)initWithImage:(UIImage*)图像
{
self=[super initWithImage:image];
如果(自我){
UIRotationGestureRecognizer*rotationGestureRecognizer=[[UIRotationGestureRecognizer alloc]initWithTarget:self action:];
[自添加手势识别器:旋转手势识别器];
}
回归自我;
}
-(无效)手柄旋转:(UIRotationGestureRecognitor*)参数发送器
{
自我转换
}
类无法识别self.transform这是为什么?
UIImage
不是从UIView
继承的,它是从NSObject
继承的。您应该改为子类
查看类以查看继承
是UIImage的子类
我不能使用任何UIView属性
因为您需要从
UIView
继承才能使用它的继承属性,或者从UIImageView
抱歉,我的坏消息。子类来自UIImageView。还是没什么,真的很奇怪。我只是尝试了一下,我可以很好地使用转换属性。。。