CGPoint variable initialized in @interface of .m file can't have value

75 views Asked by At

I am having a problem with CGPoint, I couldn’t find any answer here as well, so I made this question, I want 2 variables to be accessible around the .m file, however when I try to put a value in the CGPoint variable it’s giving me an “Expected expression”. I am a beginner in iOS app development, so I don’t really know how would I be able to fix that, can anybody give me tips about this? I would appreciate it a lot. Here’s a sample code of what I’m trying to do

at the .m file:

@interface file()

{

    CGPoint sample1;
    CGPoint sample2;
}

@implementation file

-(void)viewDidLoad(){

   sample1 = {5.0, 8.0};    ->> and this is where I’m getting the “expected expression” error.
   sample2 = {4.0, 2.0};    ->> and this is where I’m getting the “expected expression” error.

 }
1

There are 1 answers

0
Ben Zotto On BEST ANSWER
sample1 = CGPointMake(5.0, 8.0);
sample2 = CGPointMake(4.0, 2.0);