Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS CGFloat语义问题--操作数无效_Ios_Objective C_Uiview_Uigesturerecognizer_Cgfloat - Fatal编程技术网

iOS CGFloat语义问题--操作数无效

iOS CGFloat语义问题--操作数无效,ios,objective-c,uiview,uigesturerecognizer,cgfloat,Ios,Objective C,Uiview,Uigesturerecognizer,Cgfloat,在我的接口中有两个CFFloat属性。我试图在手势识别器中使用它们,但我继续得到错误,将无效操作数转换为二进制表达式float和double。。在带有allTouchesAreOnPreviewLayer的if语句中。我不确定如何正确地解决这个问题。如果你需要更多信息,请告诉我。我正在尝试在UIView上实现一个收缩缩放 接口属性: CGFloat *startingScale; CGFloat *effectiveScale; 实施方法: -(BOOL)gestureRecognizerSh

在我的接口中有两个CFFloat属性。我试图在手势识别器中使用它们,但我继续得到错误,将无效操作数转换为二进制表达式float和double。。在带有allTouchesAreOnPreviewLayer的if语句中。我不确定如何正确地解决这个问题。如果你需要更多信息,请告诉我。我正在尝试在UIView上实现一个收缩缩放

接口属性:

CGFloat *startingScale;
CGFloat *effectiveScale;
实施方法:

-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
 {
 if ([gestureRecognizer isKindOfClass:[UIPinchGestureRecognizer class]]) {

    startingScale = effectiveScale;
}

return YES;
}

-(IBAction)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer
{
NSLog(@"Pinched View");


BOOL allTouchesAreOnThePreviewLayer = YES;
NSUInteger numTouches = [recognizer numberOfTouches], i;
for ( i = 0; i < numTouches; ++i ) {
    CGPoint location = [recognizer locationOfTouch:i inView:imagePreview];
    CGPoint convertedLocation = [captureVideoPreviewLayer convertPoint:location fromLayer:captureVideoPreviewLayer.superlayer];
    if ( ! [captureVideoPreviewLayer containsPoint:convertedLocation] ) {
        allTouchesAreOnThePreviewLayer = NO;
        break;
    }
}
//错误如下:

if ( allTouchesAreOnThePreviewLayer )
{
    effectiveScale = startingScale * recognizer.scale;
    if (effectiveScale < 1.0)
        effectiveScale = 1.0;
    CGFloat maxScaleAndCropFactor = [[stillImageOutput connectionWithMediaType:AVMediaTypeVideo] videoMaxScaleAndCropFactor];
    if (effectiveScale > maxScaleAndCropFactor)
        effectiveScale = maxScaleAndCropFactor;
    [CATransaction begin];
    [CATransaction setAnimationDuration:.025];
    [captureVideoPreviewLayer setAffineTransform:CGAffineTransformMakeScale(*(effectiveScale), *(effectiveScale))];
    [CATransaction commit];
}



}
CFGloat是一个基本类型,而不是一个类。去掉声明中的星号。你想要:

CGFloat startingScale;
CGFloat effectiveScale;