要求成员'方向'不是结构或联合

时间:2022-10-16 21:19:14
CGPoint location = [recognizer locationInView:self.view];

[self showImageWithText:@"swipe" atPoint:location];

    if ([recognizer direction] == UISwipeGestureRecognizerDirectionLeft) {
        location.x -= 220.0;
    }
    else {
        location.x += 220.0;
    }

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.55];
    myimage.alpha = 0.0;
    myimage.center = location;
    [UIView commitAnimations];

1 个解决方案

#1


1  

Either the class instance that recognizer is an instance of is not valid or that class does not have a method direction. It might be invalid if it has not been instantiated or because it no longer points to a valid object, perhaps released and dealloced.

识别器是实例的类实例无效或该类没有方法方向。如果它尚未实例化,或者因为它不再指向有效对象(可能已释放和取消分配),则可能无效。

#1


1  

Either the class instance that recognizer is an instance of is not valid or that class does not have a method direction. It might be invalid if it has not been instantiated or because it no longer points to a valid object, perhaps released and dealloced.

识别器是实例的类实例无效或该类没有方法方向。如果它尚未实例化,或者因为它不再指向有效对象(可能已释放和取消分配),则可能无效。