开发者

What could be causing this error in Objective-C?

开发者 https://www.devze.com 2023-02-04 13:16 出处:网络
I have the following code: - (void) setConstrainedTransform: (CGAffineTransform) aTransform { imageView.transform = aTransform;

I have the following code:

  - (void) setConstrainedTransform: (CGAffineTransform) aTransform
{


    imageView.transform = aTransform;
    CGAffineTransform concat;
    CGSize asize = imageView.frame.size;

    if(asize.width开发者_StackOverflow > MAXZOOM * originalSize.width)
    {
        concat = CGAffineTransformConcat(imageView.transform, CGAffineTransformMakeScale((MAXZOOM * originalSize.width / asize.width), 1.0f));
        imageView.transform = concat;
    }
}

where MAXZOOM is defined as 2.0f.

The problem is, it shows the following error:

Expected ')' before ';' token;

I tried everything I could think of to solve it, but could not succeeded. Does anyone know what could be causing this error and how I could fix it?


Maybe you have defined the macro with a trailing semicolon?

//                  v
#define MAXZOOM 2.0f;

If so, remove that and see if the issue persists.


Just assuming: did you put a ; at the end of the #define ? Remove that, it will be put where you use MAXZOOM.

So instead of

#define MAXZOOM 2.0f;

make it

#define MAXZOOM 2.0f
0

精彩评论

暂无评论...
验证码 换一张
取 消